Completed
Pull Request — master (#207)
by Kiran
05:27
created
geodirectory-functions/post_functions.php 1 patch
Braces   +175 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)){
@@ -372,8 +373,9 @@  discard block
 block discarded – undo
372 373
             } elseif (trim($type) == 'file') {
373 374
                 if (isset($request_info[$name])) {
374 375
                     $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
376
+                    if ($request_info[$name] != '') {
377
+                                            $request_files = explode(",", $request_info[$name]);
378
+                    }
377 379
 
378 380
                     $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379 381
                     geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
@@ -428,15 +430,17 @@  discard block
 block discarded – undo
428 430
 
429 431
             foreach ($request_info['post_category'] as $taxonomy => $cat) {
430 432
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
433
+                if ($dummy) {
434
+                                    $post_category = $cat;
435
+                } else {
434 436
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
437
+                    if (!is_array($cat) && strstr($cat, ',')) {
438
+                                            $cat = explode(',', $cat);
439
+                    }
437 440
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
441
+                    if (!empty($cat) && is_array($cat)) {
442
+                                            $post_category = array_map('intval', $cat);
443
+                    }
440 444
                 }
441 445
 
442 446
                 wp_set_object_terms($last_post_id, $post_category, $taxonomy);
@@ -454,11 +458,13 @@  discard block
 block discarded – undo
454 458
         if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455 459
             $post_tags = explode(",", $request_info['post_tags']);
456 460
         } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
461
+            if ($dummy) {
462
+                            $post_tags = $request_info['post_tags'];
463
+            }
459 464
         } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
465
+            if ($dummy) {
466
+                            $post_tags = array($request_info['post_title']);
467
+            }
462 468
         }
463 469
 
464 470
         if (is_array($post_tags)) {
@@ -545,15 +551,17 @@  discard block
 block discarded – undo
545 551
 
546 552
     global $wpdb, $plugin_prefix, $post, $post_info;
547 553
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
554
+    if ($post_id == '' && !empty($post)) {
555
+            $post_id = $post->ID;
556
+    }
550 557
 
551 558
     $post_type = get_post_type($post_id);
552 559
 
553 560
     $all_postypes = geodir_get_posttypes();
554 561
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
562
+    if (!in_array($post_type, $all_postypes)) {
563
+            return false;
564
+    }
557 565
 
558 566
     $table = $plugin_prefix . $post_type . '_detail';
559 567
 
@@ -703,8 +711,9 @@  discard block
 block discarded – undo
703 711
             do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704 712
 
705 713
             return true;
706
-        } else
707
-            return false;
714
+        } else {
715
+                    return false;
716
+        }
708 717
 
709 718
     }
710 719
 }
@@ -758,8 +767,9 @@  discard block
 block discarded – undo
758 767
             }
759 768
 
760 769
 
761
-        } else
762
-            return false;
770
+        } else {
771
+                    return false;
772
+        }
763 773
     }
764 774
 }
765 775
 
@@ -790,8 +800,9 @@  discard block
 block discarded – undo
790 800
             $post_meta_set_query = '';
791 801
 
792 802
             foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
803
+                if ($mval != '') {
804
+                                    $post_meta_set_query .= $mkey . " = '', ";
805
+                }
795 806
             }
796 807
 
797 808
             $post_meta_set_query = trim($post_meta_set_query, ", ");
@@ -821,8 +832,9 @@  discard block
 block discarded – undo
821 832
                 return true;
822 833
             }
823 834
 
824
-        } else
825
-            return false;
835
+        } else {
836
+                    return false;
837
+        }
826 838
     }
827 839
 }
828 840
 
@@ -852,8 +864,9 @@  discard block
 block discarded – undo
852 864
 
853 865
         $post_type = get_post_type($post_id);
854 866
 
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
867
+        if (!in_array($post_type, $all_postypes)) {
868
+                    return false;
869
+        }
857 870
 
858 871
         $table = $plugin_prefix . $post_type . '_detail';
859 872
 
@@ -862,11 +875,13 @@  discard block
 block discarded – undo
862 875
             if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863 876
                 $meta_value = maybe_serialize($meta_value);
864 877
                 return $meta_value;
865
-            } else
866
-                return false;
878
+            } else {
879
+                            return false;
880
+            }
867 881
 
868
-        } else
869
-            return false;
882
+        } else {
883
+                    return false;
884
+        }
870 885
     }
871 886
 }
872 887
 
@@ -997,7 +1012,7 @@  discard block
 block discarded – undo
997 1012
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 1013
                                 $new_name = basename($uploaded['file']);
999 1014
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1015
+                            } else{
1001 1016
                                 print_r($uploaded);exit;
1002 1017
                             }
1003 1018
                             $external_img = false;
@@ -1022,8 +1037,9 @@  discard block
 block discarded – undo
1022 1037
                                 $file_path = $curr_img_dir . '/' . $filename;
1023 1038
                             }
1024 1039
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1040
+                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) {
1041
+                                                            unlink($img_path);
1042
+                            }
1027 1043
                         }
1028 1044
 
1029 1045
                         if (!empty($uploaded_file)) {
@@ -1052,8 +1068,9 @@  discard block
 block discarded – undo
1052 1068
                             $attachment_set = '';
1053 1069
 
1054 1070
                             foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1071
+                                if ($val != '') {
1072
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1073
+                                }
1057 1074
                             }
1058 1075
 
1059 1076
                             $attachment_set = trim($attachment_set, ", ");
@@ -1078,8 +1095,9 @@  discard block
 block discarded – undo
1078 1095
                         )
1079 1096
                     );
1080 1097
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1098
+                    if ($menu_order == 1) {
1099
+                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1100
+                    }
1083 1101
 
1084 1102
                 }
1085 1103
 
@@ -1120,8 +1138,9 @@  discard block
 block discarded – undo
1120 1138
 
1121 1139
         $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1140
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1141
+        if (!empty($invalid_files)) {
1142
+                    geodir_remove_attachments($invalid_files);
1143
+        }
1125 1144
     }
1126 1145
 
1127 1146
 }
@@ -1174,16 +1193,19 @@  discard block
 block discarded – undo
1174 1193
 function geodir_delete_directory($dirname)
1175 1194
 {
1176 1195
     $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1196
+    if (is_dir($dirname)) {
1197
+            $dir_handle = opendir($dirname);
1198
+    }
1199
+    if (!$dir_handle) {
1200
+            return false;
1201
+    }
1181 1202
     while ($file = readdir($dir_handle)) {
1182 1203
         if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1204
+            if (!is_dir($dirname . "/" . $file)) {
1205
+                            unlink($dirname . "/" . $file);
1206
+            } else {
1207
+                            geodir_delete_directory($dirname . '/' . $file);
1208
+            }
1187 1209
         }
1188 1210
     }
1189 1211
     closedir($dir_handle);
@@ -1212,8 +1234,9 @@  discard block
 block discarded – undo
1212 1234
             foreach ($postcurr_images as $postimg) {
1213 1235
                 $image_name_arr = explode('/', $postimg->src);
1214 1236
                 $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1237
+                if (file_exists($uploads_dir . '/' . $filename)) {
1238
+                                    unlink($uploads_dir . '/' . $filename);
1239
+                }
1217 1240
             }
1218 1241
 
1219 1242
         } // endif
@@ -1265,8 +1288,9 @@  discard block
 block discarded – undo
1265 1288
 
1266 1289
             $file_info = pathinfo($file);
1267 1290
             $sub_dir = '';
1268
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1291
+            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1292
+                            $sub_dir = stripslashes_deep($file_info['dirname']);
1293
+            }
1270 1294
 
1271 1295
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272 1296
             $uploads_baseurl = $uploads['baseurl'];
@@ -1310,9 +1334,9 @@  discard block
 block discarded – undo
1310 1334
                 $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1311 1335
             }
1312 1336
 
1313
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1314
-                $default_img = $default_catimg['src'];
1315
-            elseif ($no_image) {
1337
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1338
+                            $default_img = $default_catimg['src'];
1339
+            } elseif ($no_image) {
1316 1340
                 $default_img = get_option('geodir_listing_no_img');
1317 1341
             }
1318 1342
 
@@ -1344,10 +1368,13 @@  discard block
 block discarded – undo
1344 1368
             }
1345 1369
         }
1346 1370
 
1347
-        if (!empty($img_arr))
1348
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1349
-        else
1350
-            return false;
1371
+        if (!empty($img_arr)) {
1372
+                    return (object)$img_arr;
1373
+        }
1374
+        //return (object)array( 'src' => $file_url, 'path' => $file_path );
1375
+        else {
1376
+                    return false;
1377
+        }
1351 1378
     }
1352 1379
 }
1353 1380
 
@@ -1374,8 +1401,9 @@  discard block
 block discarded – undo
1374 1401
             echo $html;
1375 1402
         } elseif (!empty($html)) {
1376 1403
             return $html;
1377
-        } else
1378
-            return false;
1404
+        } else {
1405
+                    return false;
1406
+        }
1379 1407
     }
1380 1408
 }
1381 1409
 
@@ -1403,8 +1431,9 @@  discard block
 block discarded – undo
1403 1431
         }
1404 1432
         $not_featured = '';
1405 1433
         $sub_dir = '';
1406
-        if (!$add_featured)
1407
-            $not_featured = " AND is_featured = 0 ";
1434
+        if (!$add_featured) {
1435
+                    $not_featured = " AND is_featured = 0 ";
1436
+        }
1408 1437
 
1409 1438
         $arrImages = $wpdb->get_results(
1410 1439
             $wpdb->prepare(
@@ -1425,8 +1454,9 @@  discard block
 block discarded – undo
1425 1454
 
1426 1455
                 $file_info = pathinfo($attechment->file);
1427 1456
 
1428
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1429
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1457
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1458
+                                    $sub_dir = stripslashes_deep($file_info['dirname']);
1459
+                }
1430 1460
 
1431 1461
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1432 1462
                 $uploads_baseurl = $uploads['baseurl'];
@@ -1471,9 +1501,9 @@  discard block
 block discarded – undo
1471 1501
             $default_img = '';
1472 1502
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1473 1503
             $post_type = get_post_type($post_id);
1474
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1475
-                $default_img = $default_catimg['src'];
1476
-            elseif ($no_images) {
1504
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1505
+                            $default_img = $default_catimg['src'];
1506
+            } elseif ($no_images) {
1477 1507
                 $default_img = get_option('geodir_listing_no_img');
1478 1508
             }
1479 1509
 
@@ -1508,8 +1538,9 @@  discard block
 block discarded – undo
1508 1538
                 $return_arr[] = (object)$img_arr;
1509 1539
 
1510 1540
                 return $return_arr;
1511
-            } else
1512
-                return false;
1541
+            } else {
1542
+                            return false;
1543
+            }
1513 1544
         }
1514 1545
     }
1515 1546
 }
@@ -1570,8 +1601,9 @@  discard block
 block discarded – undo
1570 1601
                         $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1571 1602
                     } else if ($image->width < ($max_size->h)) {
1572 1603
                         $width_per = round((($image->width / $max_size->w) * 100), 2);
1573
-                    } else
1574
-                        $width_per = 100;
1604
+                    } else {
1605
+                                            $width_per = 100;
1606
+                    }
1575 1607
                 }
1576 1608
 
1577 1609
                 if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
@@ -1586,8 +1618,9 @@  discard block
 block discarded – undo
1586 1618
             echo $html;
1587 1619
         } elseif (!empty($html)) {
1588 1620
             return $html;
1589
-        } else
1590
-            return false;
1621
+        } else {
1622
+                    return false;
1623
+        }
1591 1624
     }
1592 1625
 }
1593 1626
 
@@ -1625,8 +1658,9 @@  discard block
 block discarded – undo
1625 1658
                 $post_obj = get_post($post_id);
1626 1659
 
1627 1660
                 $cat_ids = array('0');
1628
-                if (is_array($tt_ids))
1629
-                    $cat_ids = $tt_ids;
1661
+                if (is_array($tt_ids)) {
1662
+                                    $cat_ids = $tt_ids;
1663
+                }
1630 1664
 
1631 1665
 
1632 1666
                 if (!empty($cat_ids)) {
@@ -1683,8 +1717,9 @@  discard block
 block discarded – undo
1683 1717
                         $json .= '}';
1684 1718
 
1685 1719
 
1686
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1687
-                            $post_marker_json = $json;
1720
+                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) {
1721
+                                                    $post_marker_json = $json;
1722
+                        }
1688 1723
 
1689 1724
 
1690 1725
                         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)))) {
@@ -1715,10 +1750,13 @@  discard block
 block discarded – undo
1715 1750
                 if (!empty($post_term) && is_array($post_term)) {
1716 1751
                     $categories = implode(',', $post_term);
1717 1752
 
1718
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1753
+                    if ($categories != '' && $categories != 0) {
1754
+                    	$categories = ',' . $categories . ',';
1755
+                    }
1719 1756
 
1720
-                    if (empty($post_marker_json))
1721
-                        $post_marker_json = isset($json) ? $json : '';
1757
+                    if (empty($post_marker_json)) {
1758
+                                            $post_marker_json = isset($json) ? $json : '';
1759
+                    }
1722 1760
 
1723 1761
                     if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1724 1762
 
@@ -1757,8 +1795,9 @@  discard block
 block discarded – undo
1757 1795
 
1758 1796
                                 }
1759 1797
 
1760
-                                if ($default_category == '')
1761
-                                    $default_category = $categories[0];
1798
+                                if ($default_category == '') {
1799
+                                                                    $default_category = $categories[0];
1800
+                                }
1762 1801
 
1763 1802
                                 geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1764 1803
 
@@ -1902,7 +1941,7 @@  discard block
 block discarded – undo
1902 1941
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1903 1942
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1904 1943
                             <?php
1905
-                            }else{
1944
+                            } else{
1906 1945
                                 echo '<div class="geodir-bubble_image"></div>';
1907 1946
                             }
1908 1947
                         } else {
@@ -1910,7 +1949,7 @@  discard block
 block discarded – undo
1910 1949
                                 ?>
1911 1950
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1912 1951
                             <?php
1913
-                            }else{
1952
+                            } else{
1914 1953
                                 echo '<div class="geodir-bubble_image"></div>';
1915 1954
                             }
1916 1955
                         }
@@ -2001,10 +2040,11 @@  discard block
 block discarded – undo
2001 2040
      */
2002 2041
     function geodir_new_post_default_status()
2003 2042
     {
2004
-        if (get_option('geodir_new_post_default_status'))
2005
-            return get_option('geodir_new_post_default_status');
2006
-        else
2007
-            return 'publish';
2043
+        if (get_option('geodir_new_post_default_status')) {
2044
+                    return get_option('geodir_new_post_default_status');
2045
+        } else {
2046
+                    return 'publish';
2047
+        }
2008 2048
 
2009 2049
     }
2010 2050
 }
@@ -2155,8 +2195,9 @@  discard block
 block discarded – undo
2155 2195
 
2156 2196
         $all_postypes = geodir_get_posttypes();
2157 2197
 
2158
-        if (!in_array($post_type, $all_postypes))
2159
-            return false;
2198
+        if (!in_array($post_type, $all_postypes)) {
2199
+                    return false;
2200
+        }
2160 2201
 
2161 2202
         $table = $plugin_prefix . $post_type . '_detail';
2162 2203
 
@@ -2424,8 +2465,9 @@  discard block
 block discarded – undo
2424 2465
         $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2425 2466
 
2426 2467
         $user_meta_data = '';
2427
-        if (isset($current_user->data->ID))
2428
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2468
+        if (isset($current_user->data->ID)) {
2469
+                    $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2470
+        }
2429 2471
 
2430 2472
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2431 2473
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
@@ -2438,8 +2480,9 @@  discard block
 block discarded – undo
2438 2480
 
2439 2481
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2440 2482
                 $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2441
-            } else
2442
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2483
+            } else {
2484
+                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2485
+            }
2443 2486
 
2444 2487
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2445 2488
                                                                                         href="javascript:void(0);"
@@ -2502,14 +2545,16 @@  discard block
 block discarded – undo
2502 2545
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2503 2546
 
2504 2547
             $cat_post_count = $wpdb->get_var($count_query);
2505
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2506
-                $cat_post_count = 0;
2548
+            if (empty($cat_post_count) || is_wp_error($cat_post_count)) {
2549
+                            $cat_post_count = 0;
2550
+            }
2507 2551
 
2508 2552
             return $cat_post_count;
2509 2553
 
2510
-        } else
2511
-
2512
-            return $term->count;
2554
+        } else {
2555
+        
2556
+            return $term->count;
2557
+        }
2513 2558
     }
2514 2559
     return false;
2515 2560
 
@@ -2556,13 +2601,15 @@  discard block
 block discarded – undo
2556 2601
 		return $length;
2557 2602
 	}
2558 2603
 	
2559
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2560
-        $length = get_option('geodir_desc_word_limit');
2561
-    elseif (get_query_var('excerpt_length'))
2562
-        $length = get_query_var('excerpt_length');
2604
+    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) {
2605
+            $length = get_option('geodir_desc_word_limit');
2606
+    } elseif (get_query_var('excerpt_length')) {
2607
+            $length = get_query_var('excerpt_length');
2608
+    }
2563 2609
 
2564
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2565
-        $length = get_option('geodir_author_desc_word_limit');
2610
+    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) {
2611
+            $length = get_option('geodir_author_desc_word_limit');
2612
+    }
2566 2613
 
2567 2614
     return $length;
2568 2615
 }
@@ -2695,10 +2742,11 @@  discard block
 block discarded – undo
2695 2742
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2696 2743
 {
2697 2744
     $listing_author_id = geodir_get_listing_author($listing_id);
2698
-    if ($listing_author_id == $user_id)
2699
-        return true;
2700
-    else
2701
-        return false;
2745
+    if ($listing_author_id == $user_id) {
2746
+            return true;
2747
+    } else {
2748
+            return false;
2749
+    }
2702 2750
 
2703 2751
 }
2704 2752
 
@@ -2747,10 +2795,11 @@  discard block
 block discarded – undo
2747 2795
     $pattern = '/-\d+x\d+\./';
2748 2796
     preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2749 2797
 
2750
-    if (empty($matches))
2751
-        return '';
2752
-    else
2753
-        return $file;
2798
+    if (empty($matches)) {
2799
+            return '';
2800
+    } else {
2801
+            return $file;
2802
+    }
2754 2803
 
2755 2804
 }
2756 2805
 
@@ -2835,8 +2884,9 @@  discard block
 block discarded – undo
2835 2884
     } else {
2836 2885
         //set_post_thumbnail($post_id,-1);
2837 2886
 
2838
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2839
-            wp_delete_attachment($post_thumbnail_id);
2887
+        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2888
+                    wp_delete_attachment($post_thumbnail_id);
2889
+        }
2840 2890
 
2841 2891
     }
2842 2892
 }
@@ -2921,8 +2971,9 @@  discard block
 block discarded – undo
2921 2971
 
2922 2972
     global $wpdb;
2923 2973
 
2924
-    if ($listing_type == '')
2925
-        $listing_type = 'gd_place';
2974
+    if ($listing_type == '') {
2975
+            $listing_type = 'gd_place';
2976
+    }
2926 2977
 
2927 2978
     $fields_info = array();
2928 2979
 
@@ -2945,8 +2996,9 @@  discard block
 block discarded – undo
2945 2996
 
2946 2997
                 $fields_info[$prefix . 'address'] = $data->field_type;
2947 2998
 
2948
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2949
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2999
+                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
3000
+                                    $fields_info[$prefix . 'zip'] = $data->field_type;
3001
+                }
2950 3002
 
2951 3003
             } else {
2952 3004
 
Please login to merge, or discard this patch.