Test Failed
Pull Request — master (#367)
by Kiran
17:35
created
geodirectory-functions/post_functions.php 1 patch
Braces   +174 added lines, -123 removed lines patch added patch discarded remove patch
@@ -21,12 +21,13 @@  discard block
 block discarded – undo
21 21
 {
22 22
 
23 23
     $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
24
+    if (!empty($post_cat_ids)) {
25
+            $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+    }
26 27
 
27 28
     if (!isset($default_cat) || empty($default_cat)) {
28 29
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
+    } else{
30 31
         if(!is_int($default_cat)){
31 32
             $category = get_term_by('name', $default_cat, $taxonomy);
32 33
             if(isset($category->term_id)){
@@ -384,8 +385,9 @@  discard block
 block discarded – undo
384 385
             } elseif (trim($type) == 'file') {
385 386
                 if (isset($request_info[$name])) {
386 387
                     $request_files = array();
387
-                    if ($request_info[$name] != '')
388
-                        $request_files = explode(",", $request_info[$name]);
388
+                    if ($request_info[$name] != '') {
389
+                                            $request_files = explode(",", $request_info[$name]);
390
+                    }
389 391
 
390 392
                     $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
391 393
                     geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
@@ -412,7 +414,7 @@  discard block
 block discarded – undo
412 414
 
413 415
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
414 416
 
415
-                        }else{
417
+                        } else{
416 418
                             $post_htmlvar_value = $request_info[$name];
417 419
                         }
418 420
 
@@ -452,15 +454,17 @@  discard block
 block discarded – undo
452 454
 
453 455
             foreach ($request_info['post_category'] as $taxonomy => $cat) {
454 456
 
455
-                if ($dummy)
456
-                    $post_category = $cat;
457
-                else {
457
+                if ($dummy) {
458
+                                    $post_category = $cat;
459
+                } else {
458 460
 
459
-                    if (!is_array($cat) && strstr($cat, ','))
460
-                        $cat = explode(',', $cat);
461
+                    if (!is_array($cat) && strstr($cat, ',')) {
462
+                                            $cat = explode(',', $cat);
463
+                    }
461 464
 
462
-                    if (!empty($cat) && is_array($cat))
463
-                        $post_category = array_map('intval', $cat);
465
+                    if (!empty($cat) && is_array($cat)) {
466
+                                            $post_category = array_map('intval', $cat);
467
+                    }
464 468
                 }
465 469
 
466 470
                 wp_set_object_terms($last_post_id, $post_category, $taxonomy);
@@ -478,11 +482,13 @@  discard block
 block discarded – undo
478 482
         if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
479 483
             $post_tags = explode(",", $request_info['post_tags']);
480 484
         } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
481
-            if ($dummy)
482
-                $post_tags = $request_info['post_tags'];
485
+            if ($dummy) {
486
+                            $post_tags = $request_info['post_tags'];
487
+            }
483 488
         } else {
484
-            if ($dummy)
485
-                $post_tags = array($request_info['post_title']);
489
+            if ($dummy) {
490
+                            $post_tags = array($request_info['post_title']);
491
+            }
486 492
         }
487 493
 
488 494
         if (is_array($post_tags)) {
@@ -569,15 +575,17 @@  discard block
 block discarded – undo
569 575
 
570 576
     global $wpdb, $plugin_prefix, $post, $post_info;
571 577
 
572
-    if ($post_id == '' && !empty($post))
573
-        $post_id = $post->ID;
578
+    if ($post_id == '' && !empty($post)) {
579
+            $post_id = $post->ID;
580
+    }
574 581
 
575 582
     $post_type = get_post_type($post_id);
576 583
 
577 584
     $all_postypes = geodir_get_posttypes();
578 585
 
579
-    if (!in_array($post_type, $all_postypes))
580
-        return false;
586
+    if (!in_array($post_type, $all_postypes)) {
587
+            return false;
588
+    }
581 589
 
582 590
     $table = $plugin_prefix . $post_type . '_detail';
583 591
 
@@ -737,8 +745,9 @@  discard block
 block discarded – undo
737 745
             do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
738 746
 
739 747
             return true;
740
-        } else
741
-            return false;
748
+        } else {
749
+                    return false;
750
+        }
742 751
 
743 752
     }
744 753
 }
@@ -792,8 +801,9 @@  discard block
 block discarded – undo
792 801
             }
793 802
 
794 803
 
795
-        } else
796
-            return false;
804
+        } else {
805
+                    return false;
806
+        }
797 807
     }
798 808
 }
799 809
 
@@ -824,8 +834,9 @@  discard block
 block discarded – undo
824 834
             $post_meta_set_query = '';
825 835
 
826 836
             foreach ($postmeta as $mkey) {
827
-                if ($mval != '')
828
-                    $post_meta_set_query .= $mkey . " = '', ";
837
+                if ($mval != '') {
838
+                                    $post_meta_set_query .= $mkey . " = '', ";
839
+                }
829 840
             }
830 841
 
831 842
             $post_meta_set_query = trim($post_meta_set_query, ", ");
@@ -859,8 +870,9 @@  discard block
 block discarded – undo
859 870
                 return true;
860 871
             }
861 872
 
862
-        } else
863
-            return false;
873
+        } else {
874
+                    return false;
875
+        }
864 876
     }
865 877
 }
866 878
 
@@ -890,8 +902,9 @@  discard block
 block discarded – undo
890 902
 
891 903
         $post_type = get_post_type($post_id);
892 904
 
893
-        if (!in_array($post_type, $all_postypes))
894
-            return false;
905
+        if (!in_array($post_type, $all_postypes)) {
906
+                    return false;
907
+        }
895 908
 
896 909
         $table = $plugin_prefix . $post_type . '_detail';
897 910
 
@@ -899,8 +912,9 @@  discard block
 block discarded – undo
899 912
             $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
900 913
             if ($meta_value && $meta_value !== '') {
901 914
                 return maybe_serialize($meta_value);
902
-            } else
903
-                return $meta_value;
915
+            } else {
916
+                            return $meta_value;
917
+            }
904 918
         } else {
905 919
             return false;
906 920
         }
@@ -1034,7 +1048,7 @@  discard block
 block discarded – undo
1034 1048
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
1035 1049
                                 $new_name = basename($uploaded['file']);
1036 1050
                                 $uploaded_file = $uploaded;
1037
-                            }else{
1051
+                            } else{
1038 1052
                                 print_r($uploaded);exit;
1039 1053
                             }
1040 1054
                             $external_img = false;
@@ -1059,8 +1073,9 @@  discard block
 block discarded – undo
1059 1073
                                 $file_path = $curr_img_dir . '/' . $filename;
1060 1074
                             }
1061 1075
 
1062
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1063
-                                unlink($img_path);
1076
+                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) {
1077
+                                                            unlink($img_path);
1078
+                            }
1064 1079
                         }
1065 1080
 
1066 1081
                         if (!empty($uploaded_file)) {
@@ -1089,8 +1104,9 @@  discard block
 block discarded – undo
1089 1104
                             $attachment_set = '';
1090 1105
 
1091 1106
                             foreach ($attachment as $key => $val) {
1092
-                                if ($val != '')
1093
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1107
+                                if ($val != '') {
1108
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1109
+                                }
1094 1110
                             }
1095 1111
 
1096 1112
                             $attachment_set = trim($attachment_set, ", ");
@@ -1115,8 +1131,9 @@  discard block
 block discarded – undo
1115 1131
                         )
1116 1132
                     );
1117 1133
 
1118
-                    if ($menu_order == 1)
1119
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1134
+                    if ($menu_order == 1) {
1135
+                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1136
+                    }
1120 1137
 
1121 1138
                 }
1122 1139
 
@@ -1157,8 +1174,9 @@  discard block
 block discarded – undo
1157 1174
 
1158 1175
         $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1159 1176
 
1160
-        if (!empty($invalid_files))
1161
-            geodir_remove_attachments($invalid_files);
1177
+        if (!empty($invalid_files)) {
1178
+                    geodir_remove_attachments($invalid_files);
1179
+        }
1162 1180
     }
1163 1181
 
1164 1182
 }
@@ -1211,16 +1229,19 @@  discard block
 block discarded – undo
1211 1229
 function geodir_delete_directory($dirname)
1212 1230
 {
1213 1231
     $dir_handle = '';
1214
-    if (is_dir($dirname))
1215
-        $dir_handle = opendir($dirname);
1216
-    if (!$dir_handle)
1217
-        return false;
1232
+    if (is_dir($dirname)) {
1233
+            $dir_handle = opendir($dirname);
1234
+    }
1235
+    if (!$dir_handle) {
1236
+            return false;
1237
+    }
1218 1238
     while ($file = readdir($dir_handle)) {
1219 1239
         if ($file != "." && $file != "..") {
1220
-            if (!is_dir($dirname . "/" . $file))
1221
-                unlink($dirname . "/" . $file);
1222
-            else
1223
-                geodir_delete_directory($dirname . '/' . $file);
1240
+            if (!is_dir($dirname . "/" . $file)) {
1241
+                            unlink($dirname . "/" . $file);
1242
+            } else {
1243
+                            geodir_delete_directory($dirname . '/' . $file);
1244
+            }
1224 1245
         }
1225 1246
     }
1226 1247
     closedir($dir_handle);
@@ -1249,8 +1270,9 @@  discard block
 block discarded – undo
1249 1270
             foreach ($postcurr_images as $postimg) {
1250 1271
                 $image_name_arr = explode('/', $postimg->src);
1251 1272
                 $filename = end($image_name_arr);
1252
-                if (file_exists($uploads_dir . '/' . $filename))
1253
-                    unlink($uploads_dir . '/' . $filename);
1273
+                if (file_exists($uploads_dir . '/' . $filename)) {
1274
+                                    unlink($uploads_dir . '/' . $filename);
1275
+                }
1254 1276
             }
1255 1277
 
1256 1278
         } // endif
@@ -1309,8 +1331,9 @@  discard block
 block discarded – undo
1309 1331
 
1310 1332
             $file_info = pathinfo($file);
1311 1333
             $sub_dir = '';
1312
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1313
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1334
+            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1335
+                            $sub_dir = stripslashes_deep($file_info['dirname']);
1336
+            }
1314 1337
 
1315 1338
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1316 1339
             $uploads_baseurl = $uploads['baseurl'];
@@ -1354,9 +1377,9 @@  discard block
 block discarded – undo
1354 1377
                 $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1355 1378
             }
1356 1379
 
1357
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1358
-                $default_img = $default_catimg['src'];
1359
-            elseif ($no_image) {
1380
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1381
+                            $default_img = $default_catimg['src'];
1382
+            } elseif ($no_image) {
1360 1383
                 $default_img = get_option('geodir_listing_no_img');
1361 1384
             }
1362 1385
 
@@ -1388,10 +1411,13 @@  discard block
 block discarded – undo
1388 1411
             }
1389 1412
         }
1390 1413
 
1391
-        if (!empty($img_arr))
1392
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1393
-        else
1394
-            return false;
1414
+        if (!empty($img_arr)) {
1415
+                    return (object)$img_arr;
1416
+        }
1417
+        //return (object)array( 'src' => $file_url, 'path' => $file_path );
1418
+        else {
1419
+                    return false;
1420
+        }
1395 1421
     }
1396 1422
 }
1397 1423
 
@@ -1418,8 +1444,9 @@  discard block
 block discarded – undo
1418 1444
             echo $html;
1419 1445
         } elseif (!empty($html)) {
1420 1446
             return $html;
1421
-        } else
1422
-            return false;
1447
+        } else {
1448
+                    return false;
1449
+        }
1423 1450
     }
1424 1451
 }
1425 1452
 
@@ -1447,8 +1474,9 @@  discard block
 block discarded – undo
1447 1474
         }
1448 1475
         $not_featured = '';
1449 1476
         $sub_dir = '';
1450
-        if (!$add_featured)
1451
-            $not_featured = " AND is_featured = 0 ";
1477
+        if (!$add_featured) {
1478
+                    $not_featured = " AND is_featured = 0 ";
1479
+        }
1452 1480
 
1453 1481
         $arrImages = $wpdb->get_results(
1454 1482
             $wpdb->prepare(
@@ -1469,8 +1497,9 @@  discard block
 block discarded – undo
1469 1497
 
1470 1498
                 $file_info = pathinfo($attechment->file);
1471 1499
 
1472
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1473
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1500
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1501
+                                    $sub_dir = stripslashes_deep($file_info['dirname']);
1502
+                }
1474 1503
 
1475 1504
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1476 1505
                 $uploads_baseurl = $uploads['baseurl'];
@@ -1515,9 +1544,9 @@  discard block
 block discarded – undo
1515 1544
             $default_img = '';
1516 1545
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1517 1546
             $post_type = get_post_type($post_id);
1518
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1519
-                $default_img = $default_catimg['src'];
1520
-            elseif ($no_images) {
1547
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1548
+                            $default_img = $default_catimg['src'];
1549
+            } elseif ($no_images) {
1521 1550
                 $default_img = get_option('geodir_listing_no_img');
1522 1551
             }
1523 1552
 
@@ -1552,8 +1581,9 @@  discard block
 block discarded – undo
1552 1581
                 $return_arr[] = (object)$img_arr;
1553 1582
 
1554 1583
                 return $return_arr;
1555
-            } else
1556
-                return false;
1584
+            } else {
1585
+                            return false;
1586
+            }
1557 1587
         }
1558 1588
     }
1559 1589
 }
@@ -1614,8 +1644,9 @@  discard block
 block discarded – undo
1614 1644
                         $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1615 1645
                     } else if ($image->width < ($max_size->h)) {
1616 1646
                         $width_per = round((($image->width / $max_size->w) * 100), 2);
1617
-                    } else
1618
-                        $width_per = 100;
1647
+                    } else {
1648
+                                            $width_per = 100;
1649
+                    }
1619 1650
                 }
1620 1651
 
1621 1652
                 if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
@@ -1623,7 +1654,7 @@  discard block
 block discarded – undo
1623 1654
                 } else {
1624 1655
                     if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1625 1656
                         $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1626
-                    }else{
1657
+                    } else{
1627 1658
                         //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1628 1659
                         //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1629 1660
                         $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
@@ -1638,8 +1669,9 @@  discard block
 block discarded – undo
1638 1669
             echo $html;
1639 1670
         } elseif (!empty($html)) {
1640 1671
             return $html;
1641
-        } else
1642
-            return false;
1672
+        } else {
1673
+                    return false;
1674
+        }
1643 1675
     }
1644 1676
 }
1645 1677
 
@@ -1677,8 +1709,9 @@  discard block
 block discarded – undo
1677 1709
                 $post_obj = get_post($post_id);
1678 1710
 
1679 1711
                 $cat_ids = array('0');
1680
-                if (is_array($tt_ids))
1681
-                    $cat_ids = $tt_ids;
1712
+                if (is_array($tt_ids)) {
1713
+                                    $cat_ids = $tt_ids;
1714
+                }
1682 1715
 
1683 1716
 
1684 1717
                 if (!empty($cat_ids)) {
@@ -1735,8 +1768,9 @@  discard block
 block discarded – undo
1735 1768
                         $json .= '}';
1736 1769
 
1737 1770
 
1738
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1739
-                            $post_marker_json = $json;
1771
+                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) {
1772
+                                                    $post_marker_json = $json;
1773
+                        }
1740 1774
 
1741 1775
 
1742 1776
                         if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
@@ -1767,10 +1801,13 @@  discard block
 block discarded – undo
1767 1801
                 if (!empty($post_term) && is_array($post_term)) {
1768 1802
                     $categories = implode(',', $post_term);
1769 1803
 
1770
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1804
+                    if ($categories != '' && $categories != 0) {
1805
+                    	$categories = ',' . $categories . ',';
1806
+                    }
1771 1807
 
1772
-                    if (empty($post_marker_json))
1773
-                        $post_marker_json = isset($json) ? $json : '';
1808
+                    if (empty($post_marker_json)) {
1809
+                                            $post_marker_json = isset($json) ? $json : '';
1810
+                    }
1774 1811
 
1775 1812
                     if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1776 1813
 
@@ -1809,8 +1846,9 @@  discard block
 block discarded – undo
1809 1846
 
1810 1847
                                 }
1811 1848
 
1812
-                                if ($default_category == '')
1813
-                                    $default_category = $categories[0];
1849
+                                if ($default_category == '') {
1850
+                                                                    $default_category = $categories[0];
1851
+                                }
1814 1852
 
1815 1853
                                 geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1816 1854
 
@@ -1951,7 +1989,7 @@  discard block
 block discarded – undo
1951 1989
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1952 1990
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1953 1991
                             <?php
1954
-                            }else{
1992
+                            } else{
1955 1993
                                 echo '<div class="geodir-bubble_image"></div>';
1956 1994
                             }
1957 1995
                         } else {
@@ -1959,7 +1997,7 @@  discard block
 block discarded – undo
1959 1997
                                 ?>
1960 1998
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1961 1999
                             <?php
1962
-                            }else{
2000
+                            } else{
1963 2001
                                 echo '<div class="geodir-bubble_image"></div>';
1964 2002
                             }
1965 2003
                         }
@@ -2040,10 +2078,11 @@  discard block
 block discarded – undo
2040 2078
      */
2041 2079
     function geodir_new_post_default_status()
2042 2080
     {
2043
-        if (get_option('geodir_new_post_default_status'))
2044
-            return get_option('geodir_new_post_default_status');
2045
-        else
2046
-            return 'publish';
2081
+        if (get_option('geodir_new_post_default_status')) {
2082
+                    return get_option('geodir_new_post_default_status');
2083
+        } else {
2084
+                    return 'publish';
2085
+        }
2047 2086
 
2048 2087
     }
2049 2088
 }
@@ -2194,8 +2233,9 @@  discard block
 block discarded – undo
2194 2233
 
2195 2234
         $all_postypes = geodir_get_posttypes();
2196 2235
 
2197
-        if (!in_array($post_type, $all_postypes))
2198
-            return false;
2236
+        if (!in_array($post_type, $all_postypes)) {
2237
+                    return false;
2238
+        }
2199 2239
 
2200 2240
         $table = $plugin_prefix . $post_type . '_detail';
2201 2241
 
@@ -2463,8 +2503,9 @@  discard block
 block discarded – undo
2463 2503
         $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2464 2504
 
2465 2505
         $user_meta_data = '';
2466
-        if (isset($current_user->data->ID))
2467
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2506
+        if (isset($current_user->data->ID)) {
2507
+                    $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2508
+        }
2468 2509
 
2469 2510
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2470 2511
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
@@ -2477,8 +2518,9 @@  discard block
 block discarded – undo
2477 2518
 
2478 2519
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2479 2520
                 $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2480
-            } else
2481
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2521
+            } else {
2522
+                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2523
+            }
2482 2524
 
2483 2525
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2484 2526
                                                                                         href="javascript:void(0);"
@@ -2541,14 +2583,16 @@  discard block
 block discarded – undo
2541 2583
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2542 2584
 
2543 2585
             $cat_post_count = $wpdb->get_var($count_query);
2544
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2545
-                $cat_post_count = 0;
2586
+            if (empty($cat_post_count) || is_wp_error($cat_post_count)) {
2587
+                            $cat_post_count = 0;
2588
+            }
2546 2589
 
2547 2590
             return $cat_post_count;
2548 2591
 
2549
-        } else
2550
-
2551
-            return $term->count;
2592
+        } else {
2593
+        
2594
+            return $term->count;
2595
+        }
2552 2596
     }
2553 2597
     return false;
2554 2598
 
@@ -2595,13 +2639,15 @@  discard block
 block discarded – undo
2595 2639
 		return $length;
2596 2640
 	}
2597 2641
 	
2598
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2599
-        $length = get_option('geodir_desc_word_limit');
2600
-    elseif (get_query_var('excerpt_length'))
2601
-        $length = get_query_var('excerpt_length');
2642
+    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) {
2643
+            $length = get_option('geodir_desc_word_limit');
2644
+    } elseif (get_query_var('excerpt_length')) {
2645
+            $length = get_query_var('excerpt_length');
2646
+    }
2602 2647
 
2603
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2604
-        $length = get_option('geodir_author_desc_word_limit');
2648
+    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) {
2649
+            $length = get_option('geodir_author_desc_word_limit');
2650
+    }
2605 2651
 
2606 2652
     return $length;
2607 2653
 }
@@ -2734,10 +2780,11 @@  discard block
 block discarded – undo
2734 2780
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2735 2781
 {
2736 2782
     $listing_author_id = geodir_get_listing_author($listing_id);
2737
-    if ($listing_author_id == $user_id)
2738
-        return true;
2739
-    else
2740
-        return false;
2783
+    if ($listing_author_id == $user_id) {
2784
+            return true;
2785
+    } else {
2786
+            return false;
2787
+    }
2741 2788
 
2742 2789
 }
2743 2790
 
@@ -2786,10 +2833,11 @@  discard block
 block discarded – undo
2786 2833
     $pattern = '/-\d+x\d+\./';
2787 2834
     preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2788 2835
 
2789
-    if (empty($matches))
2790
-        return '';
2791
-    else
2792
-        return $file;
2836
+    if (empty($matches)) {
2837
+            return '';
2838
+    } else {
2839
+            return $file;
2840
+    }
2793 2841
 
2794 2842
 }
2795 2843
 
@@ -2874,8 +2922,9 @@  discard block
 block discarded – undo
2874 2922
     } else {
2875 2923
         //set_post_thumbnail($post_id,-1);
2876 2924
 
2877
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2878
-            wp_delete_attachment($post_thumbnail_id);
2925
+        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2926
+                    wp_delete_attachment($post_thumbnail_id);
2927
+        }
2879 2928
 
2880 2929
     }
2881 2930
 }
@@ -2960,8 +3009,9 @@  discard block
 block discarded – undo
2960 3009
 
2961 3010
     global $wpdb;
2962 3011
 
2963
-    if ($listing_type == '')
2964
-        $listing_type = 'gd_place';
3012
+    if ($listing_type == '') {
3013
+            $listing_type = 'gd_place';
3014
+    }
2965 3015
 
2966 3016
     $fields_info = array();
2967 3017
 
@@ -2984,8 +3034,9 @@  discard block
 block discarded – undo
2984 3034
 
2985 3035
                 $fields_info[$prefix . 'address'] = $data->field_type;
2986 3036
 
2987
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2988
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
3037
+                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
3038
+                                    $fields_info[$prefix . 'zip'] = $data->field_type;
3039
+                }
2989 3040
 
2990 3041
             } else {
2991 3042
 
Please login to merge, or discard this patch.