Passed
Pull Request — master (#205)
by Kiran
06:14
created
geodirectory-admin/admin_hooks_actions.php 1 patch
Braces   +58 added lines, -50 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 avoide Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+                // this will avoide 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
              *
@@ -313,8 +316,9 @@  discard block
 block discarded – undo
313 316
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
314 317
 
315 318
         foreach ($notification as $key => $value) {
316
-            if ($value['type'] == 'textarea')
317
-                $notification[$key]['type'] = 'editor';
319
+            if ($value['type'] == 'textarea') {
320
+                            $notification[$key]['type'] = 'editor';
321
+            }
318 322
         }
319 323
 
320 324
     }
@@ -339,8 +343,9 @@  discard block
 block discarded – undo
339 343
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
340 344
 
341 345
         foreach ($design_setting as $key => $value) {
342
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
343
-                $design_setting[$key]['type'] = 'editor';
346
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
347
+                            $design_setting[$key]['type'] = 'editor';
348
+            }
344 349
         }
345 350
 
346 351
     }
@@ -715,8 +720,9 @@  discard block
 block discarded – undo
715 720
 
716 721
     if (!get_option('geodir_remove_unnecessary_fields')) {
717 722
 
718
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
719
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
723
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
724
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
725
+        }
720 726
 
721 727
         update_option('geodir_remove_unnecessary_fields', '1');
722 728
 
@@ -742,15 +748,17 @@  discard block
 block discarded – undo
742 748
         $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
743 749
         switch ($geodir_admin_ajax_action) {
744 750
             case 'diagnosis' :
745
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
746
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
751
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
752
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
753
+                }
747 754
                 call_user_func('geodir_diagnose_' . $diagnose_this);
748 755
                 exit();
749 756
                 break;
750 757
 
751 758
             case 'diagnosis-fix' :
752
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
753
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
759
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
760
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
761
+                }
754 762
                 call_user_func('geodir_diagnose_' . $diagnose_this);
755 763
                 exit();
756 764
                 break;
@@ -1308,11 +1316,11 @@  discard block
 block discarded – undo
1308 1316
     //////////////////////////////////
1309 1317
     $option_value = get_option('geodir_home_page');
1310 1318
     $page = get_post($option_value);
1311
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1319
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1312 1320
 
1313
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1314
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315
-    else {
1321
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1322
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1323
+    } else {
1316 1324
         $is_error_during_diagnose = true;
1317 1325
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1318 1326
         if ($fix) {
@@ -1333,11 +1341,11 @@  discard block
 block discarded – undo
1333 1341
     //////////////////////////////////
1334 1342
     $option_value = get_option('geodir_add_listing_page');
1335 1343
     $page = get_post($option_value);
1336
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1344
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1337 1345
 
1338
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1339
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340
-    else {
1346
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1347
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1348
+    } else {
1341 1349
         $is_error_during_diagnose = true;
1342 1350
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1343 1351
         if ($fix) {
@@ -1359,11 +1367,11 @@  discard block
 block discarded – undo
1359 1367
     //////////////////////////////////
1360 1368
     $option_value = get_option('geodir_preview_page');
1361 1369
     $page = get_post($option_value);
1362
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1370
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1363 1371
 
1364
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1365
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366
-    else {
1372
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1373
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1374
+    } else {
1367 1375
         $is_error_during_diagnose = true;
1368 1376
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1369 1377
         if ($fix) {
@@ -1384,11 +1392,11 @@  discard block
 block discarded – undo
1384 1392
     //////////////////////////////////
1385 1393
     $option_value = get_option('geodir_success_page');
1386 1394
     $page = get_post($option_value);
1387
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1395
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1388 1396
 
1389
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1390
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391
-    else {
1397
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1398
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1399
+    } else {
1392 1400
         $is_error_during_diagnose = true;
1393 1401
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1394 1402
         if ($fix) {
@@ -1409,11 +1417,11 @@  discard block
 block discarded – undo
1409 1417
     //////////////////////////////////
1410 1418
     $option_value = get_option('geodir_info_page');
1411 1419
     $page = get_post($option_value);
1412
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1420
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1413 1421
 
1414
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1415
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416
-    else {
1422
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1423
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1424
+    } else {
1417 1425
         $is_error_during_diagnose = true;
1418 1426
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1419 1427
         if ($fix) {
@@ -1434,11 +1442,11 @@  discard block
 block discarded – undo
1434 1442
     //////////////////////////////////
1435 1443
     $option_value = get_option('geodir_login_page');
1436 1444
     $page = get_post($option_value);
1437
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1445
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1438 1446
 
1439
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1440
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441
-    else {
1447
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1448
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1449
+    } else {
1442 1450
         $is_error_during_diagnose = true;
1443 1451
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1444 1452
         if ($fix) {
@@ -1459,11 +1467,11 @@  discard block
 block discarded – undo
1459 1467
     //////////////////////////////////
1460 1468
     $option_value = get_option('geodir_location_page');
1461 1469
     $page = get_post($option_value);
1462
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1470
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1463 1471
 
1464
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1465
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466
-    else {
1472
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1473
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1474
+    } else {
1467 1475
         $is_error_during_diagnose = true;
1468 1476
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1469 1477
         if ($fix) {
@@ -1907,8 +1915,9 @@  discard block
 block discarded – undo
1907 1915
                             );
1908 1916
 
1909 1917
                             $post_location_info = $request_info['post_location'];
1910
-                            if ($location_id = geodir_add_new_location($post_location_info))
1911
-                                $post_location_id = $location_id;
1918
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
1919
+                                                            $post_location_id = $location_id;
1920
+                            }
1912 1921
                         } else {
1913 1922
                             $post_location_id = 0;
1914 1923
                         }
@@ -1971,8 +1980,9 @@  discard block
 block discarded – undo
1971 1980
                             $attachment_set = '';
1972 1981
 
1973 1982
                             foreach ($attachment as $key => $val) {
1974
-                                if ($val != '')
1975
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1983
+                                if ($val != '') {
1984
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1985
+                                }
1976 1986
                             }
1977 1987
                             $attachment_set = trim($attachment_set, ", ");
1978 1988
 
@@ -2068,8 +2078,7 @@  discard block
 block discarded – undo
2068 2078
 
2069 2079
         $parts = json_decode($response['body']);
2070 2080
         //print_r($parts);
2071
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
-        else{
2081
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2073 2082
 
2074 2083
             update_option('gd_ga_access_token', $parts->access_token);
2075 2084
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2077,17 +2086,16 @@  discard block
 block discarded – undo
2077 2086
         }
2078 2087
 
2079 2088
 
2080
-    }
2081
-    elseif(!empty($response['response']['code'])) {
2089
+    } elseif(!empty($response['response']['code'])) {
2082 2090
         $parts = json_decode($response['body']);
2083 2091
 
2084 2092
         if(isset($parts->error)){
2085 2093
             echo $parts->error.": ".$parts->error_description;exit;
2086
-        }else{
2094
+        } else{
2087 2095
             echo $error_msg." - #2";exit;
2088 2096
         }
2089 2097
 
2090
-    }else{
2098
+    } else{
2091 2099
 
2092 2100
         echo $error_msg." - #3";exit;
2093 2101
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 1 patch
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,17 +74,20 @@  discard block
 block discarded – undo
74 74
                                 $tab_link = $args['url'];
75 75
                             }
76 76
 
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
77
+                            if (!empty($args['request'])) {
78
+                                                            $tab_link = geodir_getlink($tab_link, $args['request']);
79
+                            }
79 80
 
80 81
                             if (isset($args['target']) && $args['target'] != '') {
81 82
                                 $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
83
+                            } else {
84
+                                                            $tab_target = '';
85
+                            }
84 86
 
85 87
                             $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
+                            if ($current_tab == $name) {
89
+                                                            $tab_active = ' class="tab-active" ';
90
+                            }
88 91
                             /**
89 92
                              * Called before the individual settings tabs are output.
90 93
                              *
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 
123 126
                         <?php
124 127
                         unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
128
+                        if (isset($tabs[$current_tab]['subtabs'])) {
129
+                                                    $subtabs = $tabs[$current_tab]['subtabs'];
130
+                        }
127 131
                         $form_action = '';
128 132
 
129 133
                         if (!empty($subtabs)):
@@ -189,7 +193,10 @@  discard block
 block discarded – undo
189 193
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 194
                      return false;*/
191 195
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();'; ?>
196
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) {
197
+    echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();';
198
+}
199
+?>
193 200
                 // Countries
194 201
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 202
                     if (jQuery(this).val() == "specific") {
@@ -312,10 +319,11 @@  discard block
 block discarded – undo
312 319
                 geodir_register_defaults();
313 320
             }*/
314 321
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
322
+            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) {
323
+                            $hide_save_button = "style='display:none;'";
324
+            } else {
325
+                            $hide_save_button = '';
326
+            }
319 327
 
320 328
             /**
321 329
              * Filter weather the default save button in the GD admin settings pages should be shown.
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,23 +35,26 @@  discard block
 block discarded – undo
35 35
 
36 36
 /* ---- Delete field ---- */
37 37
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
38
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
39
-        return;
38
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
39
+            return;
40
+    }
40 41
     
41 42
     echo geodir_custom_field_delete($field_id);
42 43
 }
43 44
 
44 45
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
45
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
46
-        return;
46
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
47
+            return;
48
+    }
47 49
     
48 50
     echo geodir_custom_sort_field_delete($field_id);
49 51
 }
50 52
 
51 53
 /* ---- Save field  ---- */
52 54
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
53
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
54
-        return;
55
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
56
+            return;
57
+    }
55 58
 
56 59
     foreach ($_REQUEST as $pkey => $pval) {
57 60
         if (is_array($_REQUEST[$pkey])) {
@@ -77,8 +80,9 @@  discard block
 block discarded – undo
77 80
 
78 81
 /* ---- Save sort field  ---- */
79 82
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
80
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
81
-        return;
83
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
84
+            return;
85
+    }
82 86
 
83 87
     foreach ($_REQUEST as $pkey => $pval) {
84 88
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 1 patch
Braces   +369 added lines, -184 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_default IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query = " and is_default = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query = " and is_default IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query = " and is_default = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'detail') {
91 93
         $default_query = " and show_on_detail='1' ";
@@ -240,10 +242,12 @@  discard block
 block discarded – undo
240 242
                 }
241 243
 
242 244
                 return $field_id;
243
-            } else
244
-                return 0;
245
-        } else
246
-            return 0;
245
+            } else {
246
+                            return 0;
247
+            }
248
+        } else {
249
+                    return 0;
250
+        }
247 251
     }
248 252
 }
249 253
 
@@ -351,7 +355,9 @@  discard block
 block discarded – undo
351 355
 		}*/
352 356
 
353 357
 
354
-            if ($post_type == '') $post_type = 'gd_place';
358
+            if ($post_type == '') {
359
+                $post_type = 'gd_place';
360
+            }
355 361
 
356 362
 
357 363
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -384,20 +390,23 @@  discard block
 block discarded – undo
384 390
             }
385 391
 
386 392
             $option_values = '';
387
-            if (isset($request_field['option_values']))
388
-                $option_values = $request_field['option_values'];
393
+            if (isset($request_field['option_values'])) {
394
+                            $option_values = $request_field['option_values'];
395
+            }
389 396
 
390 397
             $cat_sort = '';
391
-            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))
392
-                $cat_sort = implode(",", $request_field['cat_sort']);
398
+            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) {
399
+                            $cat_sort = implode(",", $request_field['cat_sort']);
400
+            }
393 401
 
394 402
             $cat_filter = '';
395
-            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))
396
-                $cat_filter = implode(",", $request_field['cat_filter']);
403
+            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) {
404
+                            $cat_filter = implode(",", $request_field['cat_filter']);
405
+            }
397 406
 
398
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
399
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
400
-            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 {
401 410
                 $package_info = array();
402 411
 
403 412
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -405,22 +414,29 @@  discard block
 block discarded – undo
405 414
             }
406 415
 
407 416
 
408
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
409
-                $extra_fields = $request_field['extra'];
417
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
418
+                            $extra_fields = $request_field['extra'];
419
+            }
410 420
 
411
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
412
-                $is_default = $request_field['is_default'];
413
-            else
414
-                $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
+            }
415 426
 
416
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
417
-                $is_admin = $request_field['is_admin'];
418
-            else
419
-                $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
+            }
420 432
 
421 433
 
422
-            if ($is_active == '') $is_active = 1;
423
-            if ($is_required == '') $is_required = 0;
434
+            if ($is_active == '') {
435
+                $is_active = 1;
436
+            }
437
+            if ($is_required == '') {
438
+                $is_required = 0;
439
+            }
424 440
 
425 441
 
426 442
             if ($sort_order == '') {
@@ -688,7 +704,7 @@  discard block
 block discarded – undo
688 704
                             }
689 705
                             if($op_max){$op_size =$op_max; }
690 706
                         }
691
-                    }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
707
+                    } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
692 708
                         if(strlen($option_values)){
693 709
                             $op_size =  strlen($option_values);
694 710
                         }
@@ -705,11 +721,13 @@  discard block
 block discarded – undo
705 721
                         return __('Column change failed, you may have too many columns.','geodirectory');
706 722
                     }
707 723
 
708
-                        if (isset($request_field['cat_display_type']))
709
-                            $extra_fields = $request_field['cat_display_type'];
724
+                        if (isset($request_field['cat_display_type'])) {
725
+                                                    $extra_fields = $request_field['cat_display_type'];
726
+                        }
710 727
 
711
-                        if (isset($request_field['multi_display_type']))
712
-                            $extra_fields = $request_field['multi_display_type'];
728
+                        if (isset($request_field['multi_display_type'])) {
729
+                                                    $extra_fields = $request_field['multi_display_type'];
730
+                        }
713 731
 
714 732
 
715 733
                         break;
@@ -721,8 +739,9 @@  discard block
 block discarded – undo
721 739
                     if($alter_result===false){
722 740
                         return __('Column change failed, you may have too many columns.','geodirectory');
723 741
                     }
724
-                        if (isset($request_field['advanced_editor']))
725
-                            $extra_fields = $request_field['advanced_editor'];
742
+                        if (isset($request_field['advanced_editor'])) {
743
+                                                    $extra_fields = $request_field['advanced_editor'];
744
+                        }
726 745
 
727 746
                         break;
728 747
 
@@ -816,8 +835,9 @@  discard block
 block discarded – undo
816 835
                 );
817 836
 
818 837
 
819
-                if ($cat_sort == '')
820
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
838
+                if ($cat_sort == '') {
839
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
840
+                }
821 841
 
822 842
 
823 843
                 /**
@@ -1184,8 +1204,10 @@  discard block
 block discarded – undo
1184 1204
         }
1185 1205
 
1186 1206
         return $post_meta_info;
1187
-    else:
1188
-        return false;
1207
+    else {
1208
+        :
1209
+        return false;
1210
+    }
1189 1211
     endif;
1190 1212
 }
1191 1213
 
@@ -1238,8 +1260,9 @@  discard block
 block discarded – undo
1238 1260
         if (is_admin()) {
1239 1261
             global $post;
1240 1262
 
1241
-            if (isset($_REQUEST['post']))
1242
-                $_REQUEST['pid'] = $_REQUEST['post'];
1263
+            if (isset($_REQUEST['post'])) {
1264
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1265
+            }
1243 1266
         }
1244 1267
 
1245 1268
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1271,7 +1294,10 @@  discard block
 block discarded – undo
1271 1294
             $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272 1295
             ?>
1273 1296
             <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1274
-            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1297
+            <?php if ($admin_desc != '') {
1298
+    echo '<small>( ' . $admin_desc . ' )</small>';
1299
+}
1300
+?></h5>
1275 1301
             <?php
1276 1302
         } else if ($type == 'address') {
1277 1303
             $prefix = $name . '_';
@@ -1308,17 +1334,27 @@  discard block
 block discarded – undo
1308 1334
             }
1309 1335
 
1310 1336
             $location = geodir_get_default_location();
1311
-            if (empty($city)) $city = isset($location->city) ? $location->city : '';
1312
-            if (empty($region)) $region = isset($location->region) ? $location->region : '';
1313
-            if (empty($country)) $country = isset($location->country) ? $location->country : '';
1337
+            if (empty($city)) {
1338
+                $city = isset($location->city) ? $location->city : '';
1339
+            }
1340
+            if (empty($region)) {
1341
+                $region = isset($location->region) ? $location->region : '';
1342
+            }
1343
+            if (empty($country)) {
1344
+                $country = isset($location->country) ? $location->country : '';
1345
+            }
1314 1346
 
1315 1347
             $lat_lng_blank = false;
1316 1348
             if (empty($lat) && empty($lng)) {
1317 1349
                 $lat_lng_blank = true;
1318 1350
             }
1319 1351
 
1320
-            if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1321
-            if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1352
+            if (empty($lat)) {
1353
+                $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1354
+            }
1355
+            if (empty($lng)) {
1356
+                $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1357
+            }
1322 1358
 
1323 1359
             /**
1324 1360
              * Filter the default latitude.
@@ -1342,10 +1378,16 @@  discard block
 block discarded – undo
1342 1378
             ?>
1343 1379
 
1344 1380
             <div id="geodir_<?php echo $prefix . 'address';?>_row"
1345
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1381
+                 class="<?php if ($is_required) {
1382
+    echo 'required_field';
1383
+}
1384
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1346 1385
                 <label>
1347 1386
                     <?php _e($address_title, 'geodirectory'); ?>
1348
-                    <?php if ($is_required) echo '<span>*</span>';?>
1387
+                    <?php if ($is_required) {
1388
+    echo '<span>*</span>';
1389
+}
1390
+?>
1349 1391
                 </label>
1350 1392
                 <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1351 1393
                        id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1406,10 +1448,16 @@  discard block
 block discarded – undo
1406 1448
                 /* show lat lng */
1407 1449
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1408 1450
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1409
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1451
+                     class="<?php if ($is_required) {
1452
+    echo 'required_field';
1453
+}
1454
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1410 1455
                     <label>
1411 1456
                         <?php echo PLACE_ADDRESS_LAT; ?>
1412
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1457
+                        <?php if ($is_required) {
1458
+    echo '<span>*</span>';
1459
+}
1460
+?>
1413 1461
                     </label>
1414 1462
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1415 1463
                            id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1421,10 +1469,16 @@  discard block
 block discarded – undo
1421 1469
                 </div>
1422 1470
 
1423 1471
                 <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1424
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1472
+                     class="<?php if ($is_required) {
1473
+    echo 'required_field';
1474
+}
1475
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1425 1476
                     <label>
1426 1477
                         <?php echo PLACE_ADDRESS_LNG; ?>
1427
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1478
+                        <?php if ($is_required) {
1479
+    echo '<span>*</span>';
1480
+}
1481
+?>
1428 1482
                     </label>
1429 1483
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1430 1484
                            id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1479,26 +1533,31 @@  discard block
 block discarded – undo
1479 1533
         <?php } elseif ($type == 'text') {
1480 1534
 
1481 1535
             //number and float validation $validation_pattern
1482
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1483
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1536
+            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1484 1537
             //print_r($val);
1485 1538
             //validation
1486 1539
             if(isset($val['validation_pattern']) && $val['validation_pattern']){
1487 1540
                 $validation = 'pattern="'.$val['validation_pattern'].'"';
1488
-            }else{$validation='';}
1541
+            } else{$validation='';}
1489 1542
 
1490 1543
             // validation message
1491 1544
             if(isset($val['validation_msg']) && $val['validation_msg']){
1492 1545
                 $validation_msg = 'title="'.$val['validation_msg'].'"';
1493
-            }else{$validation_msg='';}
1546
+            } else{$validation_msg='';}
1494 1547
             ?>
1495 1548
 
1496 1549
             <div id="<?php echo $name;?>_row"
1497
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1550
+                 class="<?php if ($is_required) {
1551
+    echo 'required_field';
1552
+}
1553
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1498 1554
                 <label>
1499 1555
                     <?php $site_title = __($site_title, 'geodirectory');
1500 1556
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1501
-                    <?php if ($is_required) echo '<span>*</span>';?>
1557
+                    <?php if ($is_required) {
1558
+    echo '<span>*</span>';
1559
+}
1560
+?>
1502 1561
                 </label>
1503 1562
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1504 1563
                        value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -1514,11 +1573,17 @@  discard block
 block discarded – undo
1514 1573
             }?>
1515 1574
 
1516 1575
             <div id="<?php echo $name;?>_row"
1517
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1576
+                 class="<?php if ($is_required) {
1577
+    echo 'required_field';
1578
+}
1579
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1518 1580
                 <label>
1519 1581
                     <?php $site_title = __($site_title, 'geodirectory');
1520 1582
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1521
-                    <?php if ($is_required) echo '<span>*</span>';?>
1583
+                    <?php if ($is_required) {
1584
+    echo '<span>*</span>';
1585
+}
1586
+?>
1522 1587
                 </label>
1523 1588
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1524 1589
                        value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -1534,11 +1599,17 @@  discard block
 block discarded – undo
1534 1599
             } ?>
1535 1600
 
1536 1601
             <div id="<?php echo $name;?>_row"
1537
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1602
+                 class="<?php if ($is_required) {
1603
+    echo 'required_field';
1604
+}
1605
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1538 1606
                 <label>
1539 1607
                     <?php $site_title = __($site_title, 'geodirectory');
1540 1608
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1541
-                    <?php if ($is_required) echo '<span>*</span>';?>
1609
+                    <?php if ($is_required) {
1610
+    echo '<span>*</span>';
1611
+}
1612
+?>
1542 1613
                 </label>
1543 1614
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1544 1615
                        value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -1554,11 +1625,17 @@  discard block
 block discarded – undo
1554 1625
             }?>
1555 1626
 
1556 1627
             <div id="<?php echo $name;?>_row"
1557
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1628
+                 class="<?php if ($is_required) {
1629
+    echo 'required_field';
1630
+}
1631
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1558 1632
                 <label>
1559 1633
                     <?php $site_title = __($site_title, 'geodirectory');
1560 1634
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1561
-                    <?php if ($is_required) echo '<span>*</span>';?>
1635
+                    <?php if ($is_required) {
1636
+    echo '<span>*</span>';
1637
+}
1638
+?>
1562 1639
                 </label>
1563 1640
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1564 1641
                        value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -1573,11 +1650,17 @@  discard block
 block discarded – undo
1573 1650
 
1574 1651
         <?php } elseif ($type == 'radio') { ?>
1575 1652
             <div id="<?php echo $name;?>_row"
1576
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1653
+                 class="<?php if ($is_required) {
1654
+    echo 'required_field';
1655
+}
1656
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1577 1657
                 <label>
1578 1658
                     <?php $site_title = __($site_title, 'geodirectory');
1579 1659
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1580
-                    <?php if ($is_required) echo '<span>*</span>';?>
1660
+                    <?php if ($is_required) {
1661
+    echo '<span>*</span>';
1662
+}
1663
+?>
1581 1664
                 </label>
1582 1665
 				<?php if ($option_values) {
1583 1666
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1602,11 +1685,17 @@  discard block
 block discarded – undo
1602 1685
         <?php } elseif ($type == 'checkbox') { ?>
1603 1686
 
1604 1687
             <div id="<?php echo $name;?>_row"
1605
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1688
+                 class="<?php if ($is_required) {
1689
+    echo 'required_field';
1690
+}
1691
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1606 1692
                 <label>
1607 1693
                     <?php $site_title = __($site_title, 'geodirectory');
1608 1694
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1609
-                    <?php if ($is_required) echo '<span>*</span>';?>
1695
+                    <?php if ($is_required) {
1696
+    echo '<span>*</span>';
1697
+}
1698
+?>
1610 1699
                 </label>
1611 1700
                 <?php if ($value != '1') {
1612 1701
                     $value = '0';
@@ -1626,11 +1715,17 @@  discard block
 block discarded – undo
1626 1715
             ?>
1627 1716
 
1628 1717
             <div id="<?php echo $name;?>_row"
1629
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1718
+                 class="<?php if ($is_required) {
1719
+    echo 'required_field';
1720
+}
1721
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1630 1722
                 <label>
1631 1723
                     <?php $site_title = __($site_title, 'geodirectory');
1632 1724
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1633
-                    <?php if ($is_required) echo '<span>*</span>';?>
1725
+                    <?php if ($is_required) {
1726
+    echo '<span>*</span>';
1727
+}
1728
+?>
1634 1729
                 </label><?php
1635 1730
 
1636 1731
 
@@ -1658,11 +1753,17 @@  discard block
 block discarded – undo
1658 1753
 
1659 1754
         <?php } elseif ($type == 'select') { ?>
1660 1755
             <div id="<?php echo $name;?>_row"
1661
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1756
+                 class="<?php if ($is_required) {
1757
+    echo 'required_field';
1758
+}
1759
+?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1662 1760
                 <label>
1663 1761
                     <?php $site_title = __($site_title, 'geodirectory');
1664 1762
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1665
-                    <?php if ($is_required) echo '<span>*</span>';?>
1763
+                    <?php if ($is_required) {
1764
+    echo '<span>*</span>';
1765
+}
1766
+?>
1666 1767
                 </label>
1667 1768
                 <?php
1668 1769
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1701,11 +1802,17 @@  discard block
 block discarded – undo
1701 1802
             }
1702 1803
             ?>
1703 1804
             <div id="<?php echo $name; ?>_row"
1704
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1805
+                 class="<?php if ($is_required) {
1806
+    echo 'required_field';
1807
+}
1808
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1705 1809
                 <label>
1706 1810
                     <?php $site_title = __($site_title, 'geodirectory');
1707 1811
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1708
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1812
+                    <?php if ($is_required) {
1813
+    echo '<span>*</span>';
1814
+}
1815
+?>
1709 1816
                 </label>
1710 1817
                 <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>
1711 1818
                 <?php if ($multi_display == 'select') { ?>
@@ -1775,11 +1882,17 @@  discard block
 block discarded – undo
1775 1882
             ?>
1776 1883
 
1777 1884
             <div id="<?php echo $name; ?>_row"
1778
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1885
+                 class="<?php if ($is_required) {
1886
+    echo 'required_field';
1887
+}
1888
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1779 1889
                 <label>
1780 1890
                     <?php $site_title = __($site_title, 'geodirectory');
1781 1891
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1782
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1892
+                    <?php if ($is_required) {
1893
+    echo '<span>*</span>';
1894
+}
1895
+?>
1783 1896
                 </label>
1784 1897
 
1785 1898
                 <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -1796,8 +1909,9 @@  discard block
 block discarded – undo
1796 1909
             </div>
1797 1910
         <?php } elseif ($type == 'datepicker') {
1798 1911
 
1799
-            if ($extra_fields['date_format'] == '')
1800
-                $extra_fields['date_format'] = 'yy-mm-dd';
1912
+            if ($extra_fields['date_format'] == '') {
1913
+                            $extra_fields['date_format'] = 'yy-mm-dd';
1914
+            }
1801 1915
 
1802 1916
 
1803 1917
             $search = array('dd', 'mm', 'yy');
@@ -1835,12 +1949,18 @@  discard block
 block discarded – undo
1835 1949
 
1836 1950
             </script>
1837 1951
             <div id="<?php echo $name;?>_row"
1838
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1952
+                 class="<?php if ($is_required) {
1953
+    echo 'required_field';
1954
+}
1955
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1839 1956
                 <label>
1840 1957
 
1841 1958
                     <?php $site_title = __($site_title, 'geodirectory');
1842 1959
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1843
-                    <?php if ($is_required) echo '<span>*</span>';?>
1960
+                    <?php if ($is_required) {
1961
+    echo '<span>*</span>';
1962
+}
1963
+?>
1844 1964
                 </label>
1845 1965
 
1846 1966
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1854,8 +1974,9 @@  discard block
 block discarded – undo
1854 1974
 
1855 1975
         <?php } elseif ($type == 'time') {
1856 1976
 
1857
-            if ($value != '')
1858
-                $value = date('H:i', strtotime($value));
1977
+            if ($value != '') {
1978
+                            $value = date('H:i', strtotime($value));
1979
+            }
1859 1980
             ?>
1860 1981
             <script type="text/javascript">
1861 1982
                 jQuery(document).ready(function () {
@@ -1868,12 +1989,18 @@  discard block
 block discarded – undo
1868 1989
                 });
1869 1990
             </script>
1870 1991
             <div id="<?php echo $name;?>_row"
1871
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1992
+                 class="<?php if ($is_required) {
1993
+    echo 'required_field';
1994
+}
1995
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1872 1996
                 <label>
1873 1997
 
1874 1998
                     <?php $site_title = __($site_title, 'geodirectory');
1875 1999
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1876
-                    <?php if ($is_required) echo '<span>*</span>';?>
2000
+                    <?php if ($is_required) {
2001
+    echo '<span>*</span>';
2002
+}
2003
+?>
1877 2004
                 </label>
1878 2005
                 <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1879 2006
                        id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1889,11 +2016,17 @@  discard block
 block discarded – undo
1889 2016
                 $value = '';
1890 2017
             } ?>
1891 2018
             <div id="<?php echo $name;?>_row"
1892
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2019
+                 class="<?php if ($is_required) {
2020
+    echo 'required_field';
2021
+}
2022
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1893 2023
                 <label>
1894 2024
                     <?php $site_title = __($site_title, 'geodirectory');
1895 2025
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1896
-                    <?php if ($is_required) echo '<span>*</span>';?>
2026
+                    <?php if ($is_required) {
2027
+    echo '<span>*</span>';
2028
+}
2029
+?>
1897 2030
                 </label>
1898 2031
 
1899 2032
                 <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1927,8 +2060,9 @@  discard block
 block discarded – undo
1927 2060
                         $post_cat = implode(",", $post_cat[$name]);
1928 2061
 
1929 2062
                     } else {
1930
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1931
-                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2063
+                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2064
+                                                    $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2065
+                        }
1932 2066
                     }
1933 2067
 
1934 2068
 
@@ -1966,21 +2100,24 @@  discard block
 block discarded – undo
1966 2100
 
1967 2101
                             $cat_display == '';
1968 2102
                             $multiple = '';
1969
-                            if ($cat_display == 'multiselect')
1970
-                                $multiple = 'multiple="multiple"';
2103
+                            if ($cat_display == 'multiselect') {
2104
+                                                            $multiple = 'multiple="multiple"';
2105
+                            }
1971 2106
 
1972 2107
                             echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1973 2108
 
1974 2109
 
1975
-                            if ($cat_display == 'select')
1976
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2110
+                            if ($cat_display == 'select') {
2111
+                                                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2112
+                            }
1977 2113
 
1978 2114
                         }
1979 2115
 
1980 2116
                         echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1981 2117
 
1982
-                        if ($cat_display == 'select' || $cat_display == 'multiselect')
1983
-                            echo '</select>';
2118
+                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
2119
+                                                    echo '</select>';
2120
+                        }
1984 2121
 
1985 2122
                     } else {
1986 2123
 
@@ -2010,18 +2147,23 @@  discard block
 block discarded – undo
2010 2147
 
2011 2148
                 $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2012 2149
 
2013
-            } else
2014
-                $file_value = '';
2150
+            } else {
2151
+                            $file_value = '';
2152
+            }
2015 2153
 
2016
-            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2017
-                $file_multiple = true; // allow multiple files upload
2018
-            else
2019
-                $file_multiple = false;
2154
+            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
2155
+                            $file_multiple = true;
2156
+            }
2157
+            // allow multiple files upload
2158
+            else {
2159
+                            $file_multiple = false;
2160
+            }
2020 2161
 
2021
-            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2022
-                $file_image_limit = $extra_fields['image_limit'];
2023
-            else
2024
-                $file_image_limit = 1;
2162
+            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
2163
+                            $file_image_limit = $extra_fields['image_limit'];
2164
+            } else {
2165
+                            $file_image_limit = 1;
2166
+            }
2025 2167
 
2026 2168
             $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2027 2169
 
@@ -2029,8 +2171,9 @@  discard block
 block discarded – undo
2029 2171
 
2030 2172
             if (!empty($file_value)) {
2031 2173
                 $curImages = explode(',', $file_value);
2032
-                if (!empty($curImages))
2033
-                    $file_totImg = count($curImages);
2174
+                if (!empty($curImages)) {
2175
+                                    $file_totImg = count($curImages);
2176
+                }
2034 2177
             }
2035 2178
 			
2036 2179
 			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -2045,12 +2188,18 @@  discard block
 block discarded – undo
2045 2188
             ?>
2046 2189
 
2047 2190
             <div id="<?php echo $name;?>_row"
2048
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2191
+                 class="<?php if ($is_required) {
2192
+    echo 'required_field';
2193
+}
2194
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2049 2195
 
2050 2196
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2051 2197
                     <label
2052 2198
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2053
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2199
+                        echo $site_title; ?><?php if ($is_required) {
2200
+                            echo '<span>*</span>';
2201
+                        }
2202
+                        ?></label>
2054 2203
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2055 2204
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2056 2205
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2191,9 +2340,10 @@  discard block
 block discarded – undo
2191 2340
             $field_set_start = 0;
2192 2341
 
2193 2342
 
2194
-            if ($fields_location == 'detail')
2195
-
2196
-                $i = 1;
2343
+            if ($fields_location == 'detail') {
2344
+            
2345
+                $i = 1;
2346
+            }
2197 2347
             foreach ($fields_info as $type) {
2198 2348
 				$type = stripslashes_deep($type); // strip slashes
2199 2349
                 $html = '';
@@ -2210,8 +2360,9 @@  discard block
 block discarded – undo
2210 2360
                     $variables_array['post_id'] = $post->ID;
2211 2361
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
2212 2362
                     $variables_array['value'] = '';
2213
-                    if (isset($post->{$type['htmlvar_name']}))
2214
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2363
+                    if (isset($post->{$type['htmlvar_name']})) {
2364
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
2365
+                    }
2215 2366
                 endif;
2216 2367
 
2217 2368
                 //if($type['field_icon'])
@@ -2338,8 +2489,9 @@  discard block
 block discarded – undo
2338 2489
                             if ($fields_location == 'detail') {
2339 2490
 
2340 2491
                                 $geodir_odd_even = 'geodir_more_info_odd';
2341
-                                if ($i % 2 == 0)
2342
-                                    $geodir_odd_even = 'geodir_more_info_even';
2492
+                                if ($i % 2 == 0) {
2493
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2494
+                                }
2343 2495
 
2344 2496
                                 $i++;
2345 2497
                             }
@@ -2413,8 +2565,9 @@  discard block
 block discarded – undo
2413 2565
                             if ($fields_location == 'detail') {
2414 2566
 
2415 2567
                                 $geodir_odd_even = 'geodir_more_info_odd';
2416
-                                if ($i % 2 == 0)
2417
-                                    $geodir_odd_even = 'geodir_more_info_even';
2568
+                                if ($i % 2 == 0) {
2569
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2570
+                                }
2418 2571
 
2419 2572
                                 $i++;
2420 2573
                             }
@@ -2456,8 +2609,9 @@  discard block
 block discarded – undo
2456 2609
                             if ($fields_location == 'detail') {
2457 2610
 
2458 2611
                                 $geodir_odd_even = 'geodir_more_info_odd';
2459
-                                if ($i % 2 == 0)
2460
-                                    $geodir_odd_even = 'geodir_more_info_even';
2612
+                                if ($i % 2 == 0) {
2613
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2614
+                                }
2461 2615
 
2462 2616
                                 $i++;
2463 2617
                             }
@@ -2477,9 +2631,10 @@  discard block
 block discarded – undo
2477 2631
                         if ($post->{$type['htmlvar_name']}):
2478 2632
 
2479 2633
                             $value = '';
2480
-                            if ($post->{$type['htmlvar_name']} != '')
2481
-                                //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2482
-                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2634
+                            if ($post->{$type['htmlvar_name']} != '') {
2635
+                                                            //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2636
+                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2637
+                            }
2483 2638
 
2484 2639
                             if (strpos($field_icon, 'http') !== false) {
2485 2640
                                 $field_icon_af = '';
@@ -2494,8 +2649,9 @@  discard block
 block discarded – undo
2494 2649
                             if ($fields_location == 'detail') {
2495 2650
 
2496 2651
                                 $geodir_odd_even = 'geodir_more_info_odd';
2497
-                                if ($i % 2 == 0)
2498
-                                    $geodir_odd_even = 'geodir_more_info_even';
2652
+                                if ($i % 2 == 0) {
2653
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2654
+                                }
2499 2655
 
2500 2656
                                 $i++;
2501 2657
                             }
@@ -2528,7 +2684,7 @@  discard block
 block discarded – undo
2528 2684
                             $value = '';
2529 2685
                             if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2530 2686
                                 $value = date($date_format, strtotime($post_htmlvar_value));
2531
-                            }else{
2687
+                            } else{
2532 2688
                                 continue;
2533 2689
                             }
2534 2690
 
@@ -2545,8 +2701,9 @@  discard block
 block discarded – undo
2545 2701
                             if ($fields_location == 'detail') {
2546 2702
 
2547 2703
                                 $geodir_odd_even = 'geodir_more_info_odd';
2548
-                                if ($i % 2 == 0)
2549
-                                    $geodir_odd_even = 'geodir_more_info_even';
2704
+                                if ($i % 2 == 0) {
2705
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2706
+                                }
2550 2707
 
2551 2708
                                 $i++;
2552 2709
                             }
@@ -2578,8 +2735,9 @@  discard block
 block discarded – undo
2578 2735
                             if ($fields_location == 'detail') {
2579 2736
 
2580 2737
                                 $geodir_odd_even = 'geodir_more_info_odd';
2581
-                                if ($i % 2 == 0)
2582
-                                    $geodir_odd_even = 'geodir_more_info_even';
2738
+                                if ($i % 2 == 0) {
2739
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2740
+                                }
2583 2741
 
2584 2742
                                 $i++;
2585 2743
                             }
@@ -2603,8 +2761,9 @@  discard block
 block discarded – undo
2603 2761
                             if ($fields_location == 'detail') {
2604 2762
 
2605 2763
                                 $geodir_odd_even = 'geodir_more_info_odd';
2606
-                                if ($i % 2 == 0)
2607
-                                    $geodir_odd_even = 'geodir_more_info_even';
2764
+                                if ($i % 2 == 0) {
2765
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2766
+                                }
2608 2767
 
2609 2768
                                 $i++;
2610 2769
                             }
@@ -2654,8 +2813,9 @@  discard block
 block discarded – undo
2654 2813
                             if ($fields_location == 'detail') {
2655 2814
 
2656 2815
                                 $geodir_odd_even = 'geodir_more_info_odd';
2657
-                                if ($i % 2 == 0)
2658
-                                    $geodir_odd_even = 'geodir_more_info_even';
2816
+                                if ($i % 2 == 0) {
2817
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2818
+                                }
2659 2819
 
2660 2820
                                 $i++;
2661 2821
                             }
@@ -2675,8 +2835,10 @@  discard block
 block discarded – undo
2675 2835
 
2676 2836
                             if ($post->{$type['htmlvar_name']} == '1'):
2677 2837
                                 $html_val = __('Yes', 'geodirectory');
2678
-                            else:
2679
-                                $html_val = __('No', 'geodirectory');
2838
+                            else {
2839
+                                :
2840
+                                $html_val = __('No', 'geodirectory');
2841
+                            }
2680 2842
                             endif;
2681 2843
 
2682 2844
                             if (strpos($field_icon, 'http') !== false) {
@@ -2692,8 +2854,9 @@  discard block
 block discarded – undo
2692 2854
                             if ($fields_location == 'detail') {
2693 2855
 
2694 2856
                                 $geodir_odd_even = 'geodir_more_info_odd';
2695
-                                if ($i % 2 == 0)
2696
-                                    $geodir_odd_even = 'geodir_more_info_even';
2857
+                                if ($i % 2 == 0) {
2858
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2859
+                                }
2697 2860
 
2698 2861
                                 $i++;
2699 2862
                             }
@@ -2737,8 +2900,9 @@  discard block
 block discarded – undo
2737 2900
                             if ($fields_location == 'detail') {
2738 2901
 
2739 2902
                                 $geodir_odd_even = 'geodir_more_info_odd';
2740
-                                if ($i % 2 == 0)
2741
-                                    $geodir_odd_even = 'geodir_more_info_even';
2903
+                                if ($i % 2 == 0) {
2904
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2905
+                                }
2742 2906
 
2743 2907
                                 $i++;
2744 2908
                             }
@@ -2789,8 +2953,9 @@  discard block
 block discarded – undo
2789 2953
                             if ($fields_location == 'detail') {
2790 2954
 
2791 2955
                                 $geodir_odd_even = 'geodir_more_info_odd';
2792
-                                if ($i % 2 == 0)
2793
-                                    $geodir_odd_even = 'geodir_more_info_even';
2956
+                                if ($i % 2 == 0) {
2957
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2958
+                                }
2794 2959
 
2795 2960
                                 $i++;
2796 2961
                             }
@@ -2844,8 +3009,9 @@  discard block
 block discarded – undo
2844 3009
                             if ($fields_location == 'detail') {
2845 3010
 
2846 3011
                                 $geodir_odd_even = 'geodir_more_info_odd';
2847
-                                if ($i % 2 == 0)
2848
-                                    $geodir_odd_even = 'geodir_more_info_even';
3012
+                                if ($i % 2 == 0) {
3013
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3014
+                                }
2849 3015
 
2850 3016
                                 $i++;
2851 3017
                             }
@@ -2890,8 +3056,9 @@  discard block
 block discarded – undo
2890 3056
                                 if ($fields_location == 'detail') {
2891 3057
 
2892 3058
                                     $geodir_odd_even = 'geodir_more_info_odd';
2893
-                                    if ($i % 2 == 0)
2894
-                                        $geodir_odd_even = 'geodir_more_info_even';
3059
+                                    if ($i % 2 == 0) {
3060
+                                                                            $geodir_odd_even = 'geodir_more_info_even';
3061
+                                    }
2895 3062
 
2896 3063
                                     $i++;
2897 3064
                                 }
@@ -2911,7 +3078,7 @@  discard block
 block discarded – undo
2911 3078
                                      */
2912 3079
                                     $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2913 3080
                                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
-                                }else{
3081
+                                } else{
2915 3082
                                     $html .=  $email;
2916 3083
                                 }
2917 3084
                                 $html .= '</span></div>';
@@ -2989,8 +3156,9 @@  discard block
 block discarded – undo
2989 3156
                                 if ($fields_location == 'detail') {
2990 3157
 
2991 3158
                                     $geodir_odd_even = 'geodir_more_info_odd';
2992
-                                    if ($i % 2 == 0)
2993
-                                        $geodir_odd_even = 'geodir_more_info_even';
3159
+                                    if ($i % 2 == 0) {
3160
+                                                                            $geodir_odd_even = 'geodir_more_info_even';
3161
+                                    }
2994 3162
 
2995 3163
                                     $i++;
2996 3164
                                 }
@@ -3024,8 +3192,9 @@  discard block
 block discarded – undo
3024 3192
                             if ($fields_location == 'detail') {
3025 3193
 
3026 3194
                                 $geodir_odd_even = 'geodir_more_info_odd';
3027
-                                if ($i % 2 == 0)
3028
-                                    $geodir_odd_even = 'geodir_more_info_even';
3195
+                                if ($i % 2 == 0) {
3196
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3197
+                                }
3029 3198
 
3030 3199
                                 $i++;
3031 3200
                             }
@@ -3053,8 +3222,9 @@  discard block
 block discarded – undo
3053 3222
                             if ($fields_location == 'detail') {
3054 3223
 
3055 3224
                                 $geodir_odd_even = 'geodir_more_info_odd';
3056
-                                if ($i % 2 == 0)
3057
-                                    $geodir_odd_even = 'geodir_more_info_even';
3225
+                                if ($i % 2 == 0) {
3226
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3227
+                                }
3058 3228
 
3059 3229
                                 $i++;
3060 3230
                             }
@@ -3149,7 +3319,9 @@  discard block
 block discarded – undo
3149 3319
                      * @param string $html Custom field unfiltered HTML.
3150 3320
                      * @param array $variables_array Custom field variables array.
3151 3321
                      */
3152
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3322
+                    if ($html) {
3323
+                        echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3324
+                    }
3153 3325
 
3154 3326
                     /**
3155 3327
                      * Called after a custom fields is output on the frontend.
@@ -3183,10 +3355,11 @@  discard block
 block discarded – undo
3183 3355
 	 */
3184 3356
 	function geodir_default_date_format()
3185 3357
     {
3186
-        if ($format = get_option('date_format'))
3187
-            return $format;
3188
-        else
3189
-            return 'dd-mm-yy';
3358
+        if ($format = get_option('date_format')) {
3359
+                    return $format;
3360
+        } else {
3361
+                    return 'dd-mm-yy';
3362
+        }
3190 3363
     }
3191 3364
 }
3192 3365
 
@@ -3293,11 +3466,13 @@  discard block
 block discarded – undo
3293 3466
                     // Set an array containing a list of acceptable formats
3294 3467
                     //$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');
3295 3468
 
3296
-					if (!function_exists('wp_handle_upload'))
3297
-						require_once(ABSPATH . 'wp-admin/includes/file.php');
3469
+					if (!function_exists('wp_handle_upload')) {
3470
+											require_once(ABSPATH . 'wp-admin/includes/file.php');
3471
+					}
3298 3472
 
3299
-					if (!is_dir($geodir_uploadpath))
3300
-						mkdir($geodir_uploadpath);
3473
+					if (!is_dir($geodir_uploadpath)) {
3474
+											mkdir($geodir_uploadpath);
3475
+					}
3301 3476
 
3302 3477
 					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303 3478
 					$explode_sub_dir = explode("/", $sub_dir);
@@ -3310,16 +3485,19 @@  discard block
 block discarded – undo
3310 3485
 					}
3311 3486
 
3312 3487
 					$uploaded_file = '';
3313
-					if (file_exists($img_path))
3314
-						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3488
+					if (file_exists($img_path)) {
3489
+											$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3490
+					}
3315 3491
 
3316 3492
 					if ($curr_img_dir != $geodir_uploaddir) {
3317
-						if (file_exists($img_path))
3318
-							unlink($img_path);
3493
+						if (file_exists($img_path)) {
3494
+													unlink($img_path);
3495
+						}
3319 3496
 					}
3320 3497
 
3321
-					if (!empty($uploaded_file))
3322
-						$file_urls = $geodir_uploadurl . '/' . $new_name;
3498
+					if (!empty($uploaded_file)) {
3499
+											$file_urls = $geodir_uploadurl . '/' . $new_name;
3500
+					}
3323 3501
 
3324 3502
                 } else {
3325 3503
                     $file_urls = $post_image[$m];
@@ -3340,8 +3518,9 @@  discard block
 block discarded – undo
3340 3518
 
3341 3519
         geodir_save_post_meta($post_id, $field_id, $file_urls);
3342 3520
 
3343
-        if (!empty($invalid_files))
3344
-            geodir_remove_attachments($invalid_files);
3521
+        if (!empty($invalid_files)) {
3522
+                    geodir_remove_attachments($invalid_files);
3523
+        }
3345 3524
 
3346 3525
     }
3347 3526
 }
@@ -3567,8 +3746,9 @@  discard block
 block discarded – undo
3567 3746
 
3568 3747
         $all_postypes = geodir_get_posttypes();
3569 3748
 
3570
-        if (!in_array($post_type, $all_postypes))
3571
-            return false;
3749
+        if (!in_array($post_type, $all_postypes)) {
3750
+                    return false;
3751
+        }
3572 3752
 
3573 3753
         $fields = array();
3574 3754
 
@@ -3656,8 +3836,10 @@  discard block
 block discarded – undo
3656 3836
         }
3657 3837
 
3658 3838
         return $field_ids;
3659
-    else:
3660
-        return false;
3839
+    else {
3840
+        :
3841
+        return false;
3842
+    }
3661 3843
     endif;
3662 3844
 }
3663 3845
 
@@ -3830,8 +4012,9 @@  discard block
 block discarded – undo
3830 4012
 
3831 4013
             return $field_id;
3832 4014
 
3833
-        } else
3834
-            return 0;
4015
+        } else {
4016
+                    return 0;
4017
+        }
3835 4018
 
3836 4019
     }
3837 4020
 }
@@ -3873,8 +4056,9 @@  discard block
 block discarded – undo
3873 4056
         $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3874 4057
 
3875 4058
         $site_title = '';
3876
-        if ($site_title == '')
3877
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
4059
+        if ($site_title == '') {
4060
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
4061
+        }
3878 4062
 
3879 4063
         if ($site_title == '') {
3880 4064
             $fields = geodir_get_custom_sort_options($post_type);
@@ -3888,8 +4072,9 @@  discard block
 block discarded – undo
3888 4072
             }
3889 4073
         }
3890 4074
 
3891
-        if ($htmlvar_name == '')
3892
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
4075
+        if ($htmlvar_name == '') {
4076
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
4077
+        }
3893 4078
 
3894 4079
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
3895 4080
         
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 1 patch
Braces   +170 added lines, -121 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -153,8 +156,9 @@  discard block
 block discarded – undo
153 156
     if (get_option('geodir_show_addlisting_nav')) {
154 157
 
155 158
         $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
159
+        if (geodir_is_page('add-listing')) {
160
+                    $menu_class = 'current-menu-item';
161
+        }
158 162
 
159 163
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160 164
         $post_types = geodir_get_posttypes('object');
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
                                 if (geodir_get_addlisting_link($post_type)) {
171 175
 
172 176
                                     $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
177
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
178
+                                                                            $menu_class = 'current-menu-item';
179
+                                    }
175 180
                                     /**
176 181
                                      * Filter the menu li class.
177 182
                                      *
@@ -255,8 +260,9 @@  discard block
 block discarded – undo
255 260
                                     if (geodir_get_addlisting_link($post_type)) {
256 261
 
257 262
                                         $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
263
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
264
+                                                                                    $menu_class = 'current-menu-item';
265
+                                        }
260 266
                                         /**
261 267
                                          * Filter the menu li class.
262 268
                                          *
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
     }
312 318
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 319
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
314
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
320
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
321
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+    }
316 323
 
317 324
     return $menu;
318 325
 
@@ -398,24 +405,28 @@  discard block
 block discarded – undo
398 405
     $geodir_post_type = get_query_var('post_type');
399 406
 
400 407
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
403
-        elseif (isset($_REQUEST['listing_type']))
404
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
408
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
409
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+        } elseif (isset($_REQUEST['listing_type'])) {
411
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
412
+        }
405 413
     }
406 414
 
407
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
416
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417
+    }
409 418
 
410
-    if (is_tax())
411
-        $geodir_post_type = geodir_get_taxonomy_posttype();
419
+    if (is_tax()) {
420
+            $geodir_post_type = geodir_get_taxonomy_posttype();
421
+    }
412 422
 
413 423
 
414 424
     $all_postypes = geodir_get_posttypes();
415 425
     $all_postypes = stripslashes_deep($all_postypes);
416 426
 
417
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
-        $geodir_post_type = '';
427
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
428
+            $geodir_post_type = '';
429
+    }
419 430
 
420 431
 
421 432
     return $geodir_post_type;
@@ -462,11 +473,12 @@  discard block
 block discarded – undo
462 473
         endswitch;
463 474
     }
464 475
 
465
-    if (!empty($post_types))
466
-        return $post_types;
467
-    else
468
-        return array();
469
-}
476
+    if (!empty($post_types)) {
477
+            return $post_types;
478
+    } else {
479
+            return array();
480
+    }
481
+    }
470 482
 
471 483
 /**
472 484
  * Get Custom Post Type info.
@@ -483,9 +495,10 @@  discard block
 block discarded – undo
483 495
     $post_types = stripslashes_deep($post_types);
484 496
     if (!empty($post_types) && $post_type != '') {
485 497
         return $post_types[$post_type];
486
-    } else
487
-        return false;
488
-}
498
+    } else {
499
+            return false;
500
+    }
501
+    }
489 502
 
490 503
 if (!function_exists('geodir_get_taxonomies')) {
491 504
     /**
@@ -509,18 +522,21 @@  discard block
 block discarded – undo
509 522
             $gd_taxonomies = array_keys($taxonomies);
510 523
 
511 524
 
512
-            if ($post_type != '')
513
-                $gd_taxonomies = array();
525
+            if ($post_type != '') {
526
+                            $gd_taxonomies = array();
527
+            }
514 528
 
515 529
             $i = 0;
516 530
             foreach ($taxonomies as $taxonomy => $args) {
517 531
 
518
-                if ($post_type != '' && $args['object_type'] == $post_type)
519
-                    $gd_taxonomies[] = $taxonomy;
532
+                if ($post_type != '' && $args['object_type'] == $post_type) {
533
+                                    $gd_taxonomies[] = $taxonomy;
534
+                }
520 535
 
521 536
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
522
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
523
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
537
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
538
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
539
+                    }
524 540
                 }
525 541
 
526 542
             }
@@ -575,10 +591,11 @@  discard block
 block discarded – undo
575 591
                 . ucfirst($category_obj->name) . '</option>';
576 592
         }
577 593
 
578
-        if ($echo)
579
-            echo $html;
580
-        else
581
-            return $html;
594
+        if ($echo) {
595
+                    echo $html;
596
+        } else {
597
+                    return $html;
598
+        }
582 599
     }
583 600
 }
584 601
 
@@ -612,11 +629,12 @@  discard block
 block discarded – undo
612 629
 
613 630
     }
614 631
 
615
-    if (!empty($listing_slug))
616
-        return $listing_slug;
617
-    else
618
-        return false;
619
-}
632
+    if (!empty($listing_slug)) {
633
+            return $listing_slug;
634
+    } else {
635
+            return false;
636
+    }
637
+    }
620 638
 
621 639
 
622 640
 /**
@@ -647,16 +665,18 @@  discard block
 block discarded – undo
647 665
     if (!empty($taxonomies)) {
648 666
         foreach (geodir_get_posttypes() as $pt) {
649 667
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
-            if (array_intersect($taxonomies, $object_taxonomies))
651
-                $post_type[] = $pt;
668
+            if (array_intersect($taxonomies, $object_taxonomies)) {
669
+                            $post_type[] = $pt;
670
+            }
652 671
         }
653 672
     }
654 673
 
655
-    if (!empty($post_type))
656
-        return $post_type[0];
657
-    else
658
-        return false;
659
-}
674
+    if (!empty($post_type)) {
675
+            return $post_type[0];
676
+    } else {
677
+            return false;
678
+    }
679
+    }
660 680
 
661 681
 if (!function_exists('geodir_custom_taxonomy_walker')) {
662 682
     /**
@@ -712,18 +732,18 @@  discard block
 block discarded – undo
712 732
                 $checked = '';
713 733
 
714 734
                 if (in_array($cat_term->term_id, $search_terms)) {
715
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
716
-                        $checked = 'selected="selected"';
717
-                    else
718
-                        $checked = 'checked="checked"';
735
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
736
+                                            $checked = 'selected="selected"';
737
+                    } else {
738
+                                            $checked = 'checked="checked"';
739
+                    }
719 740
                 }
720 741
 
721
-                if ($cat_display == 'radio')
722
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
723
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
725
-
726
-                else {
742
+                if ($cat_display == 'radio') {
743
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
744
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
745
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
746
+                } else {
727 747
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
728 748
                 }
729 749
 
@@ -732,8 +752,9 @@  discard block
 block discarded – undo
732 752
 
733 753
             }
734 754
 
735
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
-                $out .= '</div>';
755
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
756
+                            $out .= '</div>';
757
+            }
737 758
 
738 759
             return $out;
739 760
         }
@@ -759,18 +780,21 @@  discard block
 block discarded – undo
759 780
         global $exclude_cats, $gd_session;
760 781
 
761 782
         $cat_exclude = '';
762
-        if (is_array($exclude_cats) && !empty($exclude_cats))
763
-            $cat_exclude = serialize($exclude_cats);
783
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
784
+                    $cat_exclude = serialize($exclude_cats);
785
+        }
764 786
 
765 787
         if (isset($_REQUEST['backandedit'])) {
766 788
             $post = (object)$gd_session->get('listing');
767 789
 
768
-            if (!is_array($post->post_category[$cat_taxonomy]))
769
-                $post_category = $post->post_category[$cat_taxonomy];
790
+            if (!is_array($post->post_category[$cat_taxonomy])) {
791
+                            $post_category = $post->post_category[$cat_taxonomy];
792
+            }
770 793
 
771 794
             $post_categories = $post->post_category_str;
772
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
773
-                $post_category_str = $post_categories[$cat_taxonomy];
795
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
796
+                            $post_category_str = $post_categories[$cat_taxonomy];
797
+            }
774 798
 
775 799
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776 800
             global $post;
@@ -961,8 +985,9 @@  discard block
 block discarded – undo
961 985
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962 986
             $post_cat_str = $post_categories[$cat_taxonomy];
963 987
             $post_cat_array = explode("#", $post_cat_str);
964
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
-                $style = "display:none;";
988
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
989
+                            $style = "display:none;";
990
+            }
966 991
         }
967 992
         ?>
968 993
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -997,7 +1022,7 @@  discard block
 block discarded – undo
997 1022
         print_r($exclude_cats);
998 1023
         if(is_array( $exclude_cats)){
999 1024
             $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
1025
+        } else{
1001 1026
             $exclude_cats = intval($exclude_cats);
1002 1027
         }
1003 1028
 
@@ -1027,7 +1052,10 @@  discard block
 block discarded – undo
1027 1052
 
1028 1053
             <div class="post_default_category">
1029 1054
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1030
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1055
+                       onchange="update_listing_cat()" <?php if ($default) {
1056
+    echo ' checked="checked" ';
1057
+}
1058
+?>   />
1031 1059
         <span> 
1032 1060
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1033 1061
         </span>
@@ -1127,8 +1155,9 @@  discard block
 block discarded – undo
1127 1155
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1128 1156
 
1129 1157
         $option_selected = '';
1130
-        if (!$selected)
1131
-            $option_slected = ' selected="selected" ';
1158
+        if (!$selected) {
1159
+                    $option_slected = ' selected="selected" ';
1160
+        }
1132 1161
 
1133 1162
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1134 1163
 
@@ -1136,8 +1165,9 @@  discard block
 block discarded – undo
1136 1165
 
1137 1166
         foreach ($cat_terms as $cat_term) {
1138 1167
             $option_selected = '';
1139
-            if ($selected == $cat_term->term_id)
1140
-                $option_selected = ' selected="selected" ';
1168
+            if ($selected == $cat_term->term_id) {
1169
+                            $option_selected = ' selected="selected" ';
1170
+            }
1141 1171
 
1142 1172
             // Count child terms
1143 1173
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1202,8 +1232,9 @@  discard block
 block discarded – undo
1202 1232
 
1203 1233
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204 1234
 
1205
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
-        $listing_slug = 'places';
1235
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1236
+            $listing_slug = 'places';
1237
+    }
1207 1238
 
1208 1239
     /**
1209 1240
      * Taxonomies
@@ -1351,7 +1382,7 @@  discard block
 block discarded – undo
1351 1382
     //print_r( $segments);
1352 1383
     if($gd_wpml_get_languages){
1353 1384
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1385
+    } else{
1355 1386
         global $sitepress;
1356 1387
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1388
     }
@@ -1494,8 +1525,9 @@  discard block
 block discarded – undo
1494 1525
                             'city_slug' => $post->city_slug
1495 1526
                         );
1496 1527
 
1497
-                    } else
1498
-                        $post_location = geodir_get_location();
1528
+                    } else {
1529
+                                            $post_location = geodir_get_location();
1530
+                    }
1499 1531
 
1500 1532
 
1501 1533
                 } else {
@@ -1524,8 +1556,9 @@  discard block
 block discarded – undo
1524 1556
                             );
1525 1557
 
1526 1558
                         }
1527
-                    } else
1528
-                        $post_location = geodir_get_location();
1559
+                    } else {
1560
+                                            $post_location = geodir_get_location();
1561
+                    }
1529 1562
                 }
1530 1563
 
1531 1564
 
@@ -1568,8 +1601,9 @@  discard block
 block discarded – undo
1568 1601
                         $post_terms = $post_terms[0];
1569 1602
                     }
1570 1603
 
1571
-                    if (!$post_terms)
1572
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1604
+                    if (!$post_terms) {
1605
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1606
+                    }
1573 1607
 
1574 1608
                     if (!$post_terms) {
1575 1609
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1583,8 +1617,9 @@  discard block
 block discarded – undo
1583 1617
 
1584 1618
                 $term = get_term_by('id', $post_terms, $taxonomies);
1585 1619
 
1586
-                if (!empty($term))
1587
-                    $term_request = $term->slug;
1620
+                if (!empty($term)) {
1621
+                                    $term_request = $term->slug;
1622
+                }
1588 1623
                 //$term_request = $term->slug.'/';
1589 1624
             }
1590 1625
 
@@ -1599,15 +1634,20 @@  discard block
 block discarded – undo
1599 1634
                 $request_term .= $term_request;
1600 1635
 
1601 1636
             } else {
1602
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1637
+                if (isset($location_request) && $location_request != '') {
1638
+                    $request_term = $location_request;
1639
+                }
1603 1640
 
1604
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1641
+                if (isset($term_request) && $term_request != '') {
1642
+                    $request_term .= $term_request;
1643
+                }
1605 1644
             }
1606 1645
             $request_term = trim($request_term, '/');
1607
-            if (!empty($request_term))
1608
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1609
-            else
1610
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1646
+            if (!empty($request_term)) {
1647
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1648
+            } else {
1649
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1650
+            }
1611 1651
             //echo $post_link ;
1612 1652
         }
1613 1653
         // temp cache the permalink
@@ -1649,8 +1689,9 @@  discard block
 block discarded – undo
1649 1689
             if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650 1690
                 $include_location = true;
1651 1691
             }
1652
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
-            $include_location = true;
1692
+        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1693
+                    $include_location = true;
1694
+        }
1654 1695
 
1655 1696
         if ($include_location) {
1656 1697
             global $post;
@@ -1800,10 +1841,11 @@  discard block
 block discarded – undo
1800 1841
     if (!is_object($obj_post_type)) {
1801 1842
         return;
1802 1843
     }
1803
-    if ($echo)
1804
-        echo $obj_post_type->labels->singular_name;
1805
-    else
1806
-        return $obj_post_type->labels->singular_name;
1844
+    if ($echo) {
1845
+            echo $obj_post_type->labels->singular_name;
1846
+    } else {
1847
+            return $obj_post_type->labels->singular_name;
1848
+    }
1807 1849
 
1808 1850
 }
1809 1851
 
@@ -1820,14 +1862,16 @@  discard block
 block discarded – undo
1820 1862
 {
1821 1863
     $all_postypes = geodir_get_posttypes();
1822 1864
 
1823
-    if (!in_array($post_type, $all_postypes))
1824
-        return false;
1865
+    if (!in_array($post_type, $all_postypes)) {
1866
+            return false;
1867
+    }
1825 1868
 
1826 1869
     $obj_post_type = get_post_type_object($post_type);
1827
-    if ($echo)
1828
-        echo $obj_post_type->labels->name;
1829
-    else
1830
-        return $obj_post_type->labels->name;
1870
+    if ($echo) {
1871
+            echo $obj_post_type->labels->name;
1872
+    } else {
1873
+            return $obj_post_type->labels->name;
1874
+    }
1831 1875
 
1832 1876
 }
1833 1877
 
@@ -1852,19 +1896,22 @@  discard block
 block discarded – undo
1852 1896
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1853 1897
 
1854 1898
     if (is_int($term)) {
1855
-        if (0 == $term)
1856
-            return 0;
1899
+        if (0 == $term) {
1900
+                    return 0;
1901
+        }
1857 1902
         $where = 't.term_id = %d';
1858
-        if (!empty($taxonomy))
1859
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1860
-        else
1861
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1903
+        if (!empty($taxonomy)) {
1904
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1905
+        } else {
1906
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1907
+        }
1862 1908
     }
1863 1909
 
1864 1910
     $term = trim(wp_unslash($term));
1865 1911
 
1866
-    if ('' === $slug = sanitize_title($term))
1867
-        return 0;
1912
+    if ('' === $slug = sanitize_title($term)) {
1913
+            return 0;
1914
+    }
1868 1915
 
1869 1916
     $where = 't.slug = %s';
1870 1917
 
@@ -1881,14 +1928,16 @@  discard block
 block discarded – undo
1881 1928
         $where_fields[] = $taxonomy;
1882 1929
 
1883 1930
 
1884
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1885
-            return $result;
1931
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1932
+                    return $result;
1933
+        }
1886 1934
 
1887 1935
         return false;
1888 1936
     }
1889 1937
 
1890
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
-        return $result;
1938
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1939
+            return $result;
1940
+    }
1892 1941
 
1893 1942
     return false;
1894 1943
 }
Please login to merge, or discard this patch.
geodirectory-functions/template_functions.php 1 patch
Braces   +58 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,16 +47,19 @@  discard block
 block discarded – undo
47 47
 
48 48
             if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49 49
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
50
-            )
51
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
50
+            ) {
51
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
52
+            }
52 53
             if (empty($post_type) && !isset($_REQUEST['pid'])) {
53 54
                 $pagename = $wp->query_vars['pagename'];
54 55
                 $post_types = geodir_get_posttypes();
55
-                if (!empty($post_types))
56
-                    $post_type = $post_types[0];
56
+                if (!empty($post_types)) {
57
+                                    $post_type = $post_types[0];
58
+                }
57 59
 					
58
-				if($sc_post_type != '' )
59
-					$post_type = $sc_post_type;
60
+				if($sc_post_type != '' ) {
61
+									$post_type = $sc_post_type;
62
+				}
60 63
 				
61 64
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
62 65
 					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
@@ -71,14 +74,16 @@  discard block
 block discarded – undo
71 74
             $success_page_id = geodir_success_page_id();
72 75
             if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
73 76
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
74
-            )
75
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
77
+            ) {
78
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
79
+            }
76 80
             return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
77 81
             break;
78 82
         case 'detail':
79 83
         case 'preview':
80
-            if (in_array(get_post_type(), geodir_get_posttypes()))
81
-                $post_type = get_post_type();
84
+            if (in_array(get_post_type(), geodir_get_posttypes())) {
85
+                            $post_type = get_post_type();
86
+            }
82 87
             return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
83 88
             break;
84 89
         case 'listing':
@@ -184,7 +189,9 @@  discard block
 block discarded – undo
184 189
 
185 190
         $template = geodir_locate_template('signup');
186 191
 
187
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
192
+        if (!$template) {
193
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
194
+        }
188 195
 
189 196
         /**
190 197
          * Filter the signup template path.
@@ -202,7 +209,9 @@  discard block
 block discarded – undo
202 209
 
203 210
             $template = geodir_locate_template('information');
204 211
 
205
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
212
+            if (!$template) {
213
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
214
+            }
206 215
             /**
207 216
              * Filter the information template path.
208 217
              *
@@ -219,7 +228,9 @@  discard block
 block discarded – undo
219 228
             if (!$is_current_user_owner) {
220 229
                 $template = geodir_locate_template('information');
221 230
 
222
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
231
+                if (!$template) {
232
+                    $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
233
+                }
223 234
                 /**
224 235
                  * Filter the information template path.
225 236
                  *
@@ -241,7 +252,9 @@  discard block
 block discarded – undo
241 252
 
242 253
         $template = geodir_locate_template('add-listing');
243 254
 
244
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
255
+        if (!$template) {
256
+            $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
257
+        }
245 258
         /**
246 259
          * Filter the add listing template path.
247 260
          *
@@ -258,7 +271,9 @@  discard block
 block discarded – undo
258 271
 
259 272
         $template = geodir_locate_template('preview');
260 273
 
261
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
274
+        if (!$template) {
275
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
276
+        }
262 277
         /**
263 278
          * Filter the preview template path.
264 279
          *
@@ -274,7 +289,9 @@  discard block
 block discarded – undo
274 289
 
275 290
         $template = geodir_locate_template('success');
276 291
 
277
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
292
+        if (!$template) {
293
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
294
+        }
278 295
         /**
279 296
          * Filter the success template path.
280 297
          *
@@ -289,7 +306,9 @@  discard block
 block discarded – undo
289 306
 
290 307
         $template = geodir_locate_template('detail');
291 308
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
309
+        if (!$template) {
310
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
311
+        }
293 312
         /**
294 313
          * Filter the detail template path.
295 314
          *
@@ -304,7 +323,9 @@  discard block
 block discarded – undo
304 323
 
305 324
         $template = geodir_locate_template('listing');
306 325
 
307
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
326
+        if (!$template) {
327
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
328
+        }
308 329
         /**
309 330
          * Filter the listing template path.
310 331
          *
@@ -319,7 +340,9 @@  discard block
 block discarded – undo
319 340
 
320 341
         $template = geodir_locate_template('search');
321 342
 
322
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
343
+        if (!$template) {
344
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
345
+        }
323 346
         /**
324 347
          * Filter the search template path.
325 348
          *
@@ -334,7 +357,9 @@  discard block
 block discarded – undo
334 357
 
335 358
         $template = geodir_locate_template('author');
336 359
 
337
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
360
+        if (!$template) {
361
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
362
+        }
338 363
         /**
339 364
          * Filter the author template path.
340 365
          *
@@ -355,7 +380,9 @@  discard block
 block discarded – undo
355 380
 
356 381
             $template = geodir_locate_template('geodir-home');
357 382
 
358
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
383
+            if (!$template) {
384
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
385
+            }
359 386
             /**
360 387
              * Filter the home page template path.
361 388
              *
@@ -368,7 +395,9 @@  discard block
 block discarded – undo
368 395
 
369 396
             $template = geodir_locate_template('location');
370 397
 
371
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
398
+            if (!$template) {
399
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
400
+            }
372 401
             /**
373 402
              * Filter the location template path.
374 403
              *
@@ -377,8 +406,9 @@  discard block
 block discarded – undo
377 406
              */
378 407
             return $template = apply_filters('geodir_template_location', $template);
379 408
 
380
-        } else
381
-            return $template;
409
+        } else {
410
+                    return $template;
411
+        }
382 412
 
383 413
     }
384 414
 
@@ -432,8 +462,10 @@  discard block
 block discarded – undo
432 462
          * @since 1.0.0
433 463
          */
434 464
         include($template);
435
-    else:
436
-        locate_template(array("geodirectory/" . $template_name), true, false);
465
+    else {
466
+        :
467
+        locate_template(array("geodirectory/" . $template_name), true, false);
468
+    }
437 469
     endif;
438 470
 
439 471
 }
Please login to merge, or discard this patch.
geodirectory_template_actions.php 1 patch
Braces   +36 added lines, -25 removed lines patch added patch discarded remove patch
@@ -714,8 +714,9 @@  discard block
 block discarded – undo
714 714
 
715 715
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716 716
                             if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
717
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
718
+                                                                    $term_icon = $term_icon_url['src'];
719
+                                }
719 720
                                 break;
720 721
                             }
721 722
                         }
@@ -1246,8 +1247,9 @@  discard block
 block discarded – undo
1246 1247
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1247 1248
     }
1248 1249
 
1249
-    if (isset($taxonomies[$post_type . '_tags']))
1250
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1250
+    if (isset($taxonomies[$post_type . '_tags'])) {
1251
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1252
+    }
1251 1253
 
1252 1254
     ?>
1253 1255
     </p><?php
@@ -1598,23 +1600,21 @@  discard block
 block discarded – undo
1598 1600
     if(geodir_is_page('pt')){
1599 1601
         $gd_page = 'pt';
1600 1602
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601
-    }
1602
-    elseif(geodir_is_page('listing')){
1603
+    } elseif(geodir_is_page('listing')){
1603 1604
         $gd_page = 'listing';
1604 1605
         global $wp_query;
1605 1606
         $current_term = $wp_query->get_queried_object();
1606 1607
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1607 1608
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1609
+        } else{
1609 1610
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610 1611
         }
1611 1612
 
1612
-    }
1613
-    elseif(geodir_is_page('author')){
1613
+    } elseif(geodir_is_page('author')){
1614 1614
         $gd_page = 'author';
1615 1615
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1616 1616
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
-        }else{
1617
+        } else{
1618 1618
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619 1619
         }
1620 1620
 
@@ -2025,8 +2025,9 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_action_add_listing_page_title()
2027 2027
 {
2028
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2029
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2028
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2029
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2030
+    }
2030 2031
     /** This action is documented in geodirectory_template_actions.php */
2031 2032
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2032 2033
     /** This action is documented in geodirectory_template_actions.php */
@@ -2038,7 +2039,7 @@  discard block
 block discarded – undo
2038 2039
         $gd_page = 'add-listing';
2039 2040
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2040 2041
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2042
+        } elseif(isset($listing_type)){
2042 2043
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043 2044
         }
2044 2045
 
@@ -2096,7 +2097,11 @@  discard block
 block discarded – undo
2096 2097
     $required_msg = '';
2097 2098
     $submit_button = '';
2098 2099
 
2099
-    if (isset($_REQUEST['ajax_action'])) $ajax_action = $_REQUEST['ajax_action']; else $ajax_action = 'add';
2100
+    if (isset($_REQUEST['ajax_action'])) {
2101
+        $ajax_action = $_REQUEST['ajax_action'];
2102
+    } else {
2103
+        $ajax_action = 'add';
2104
+    }
2100 2105
 
2101 2106
     $thumb_img_arr = array();
2102 2107
     $curImages = '';
@@ -2335,8 +2340,9 @@  discard block
 block discarded – undo
2335 2340
         $totImg = 0;
2336 2341
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2337 2342
             $post = (object)$gd_session->get('listing');
2338
-            if (isset($post->post_images))
2339
-                $curImages = trim($post->post_images, ",");
2343
+            if (isset($post->post_images)) {
2344
+                            $curImages = trim($post->post_images, ",");
2345
+            }
2340 2346
 
2341 2347
 
2342 2348
             if ($curImages != '') {
@@ -2364,10 +2370,13 @@  discard block
 block discarded – undo
2364 2370
             $totImg = count((array)$thumb_img_arr);
2365 2371
         }
2366 2372
 
2367
-        if ($curImages != '')
2368
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2369
-        else
2370
-            $svalue = '';
2373
+        if ($curImages != '') {
2374
+                    $svalue = $curImages;
2375
+        }
2376
+        // this will be initial value of the above form field. Image urls.
2377
+        else {
2378
+                    $svalue = '';
2379
+        }
2371 2380
 
2372 2381
         $image_limit = $package_info->image_limit;
2373 2382
         $show_image_input_box = ($image_limit != '0');
@@ -2577,8 +2586,9 @@  discard block
 block discarded – undo
2577 2586
     </script><?php
2578 2587
 
2579 2588
     global $errors;
2580
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2581
-        $errors->add('claim_login', LOGIN_CLAIM);
2589
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2590
+            $errors->add('claim_login', LOGIN_CLAIM);
2591
+    }
2582 2592
 
2583 2593
     if (!empty($errors)) {
2584 2594
         foreach ($errors as $errorsObj) {
@@ -2682,8 +2692,9 @@  discard block
 block discarded – undo
2682 2692
 
2683 2693
     if (!empty($term)) {
2684 2694
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2685
-        if (!empty($current_term))
2686
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2695
+        if (!empty($current_term)) {
2696
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2697
+        }
2687 2698
     }
2688 2699
 
2689 2700
 
@@ -2701,7 +2712,7 @@  discard block
 block discarded – undo
2701 2712
         $gd_page = 'author';
2702 2713
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2703 2714
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2704
-        }else{
2715
+        } else{
2705 2716
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2706 2717
         }
2707 2718
 
Please login to merge, or discard this patch.