Test Failed
Push — master ( cb1fc0...c4bbdf )
by Stiofan
19:27
created
geodirectory-functions/post_functions.php 1 patch
Braces   +168 added lines, -119 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
 
@@ -1046,7 +1059,7 @@  discard block
 block discarded – undo
1046 1059
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
1047 1060
                                 $new_name = basename($uploaded['file']);
1048 1061
                                 $uploaded_file = $uploaded;
1049
-                            }else{
1062
+                            } else{
1050 1063
                                 print_r($uploaded);exit;
1051 1064
                             }
1052 1065
                             $external_img = false;
@@ -1071,8 +1084,9 @@  discard block
 block discarded – undo
1071 1084
                                 $file_path = $curr_img_dir . '/' . $filename;
1072 1085
                             }
1073 1086
 
1074
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1075
-                                unlink($img_path);
1087
+                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) {
1088
+                                                            unlink($img_path);
1089
+                            }
1076 1090
                         }
1077 1091
 
1078 1092
                         if (!empty($uploaded_file)) {
@@ -1101,8 +1115,9 @@  discard block
 block discarded – undo
1101 1115
                             $attachment_set = '';
1102 1116
 
1103 1117
                             foreach ($attachment as $key => $val) {
1104
-                                if ($val != '')
1105
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1118
+                                if ($val != '') {
1119
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1120
+                                }
1106 1121
                             }
1107 1122
 
1108 1123
                             $attachment_set = trim($attachment_set, ", ");
@@ -1127,8 +1142,9 @@  discard block
 block discarded – undo
1127 1142
                         )
1128 1143
                     );
1129 1144
 
1130
-                    if ($menu_order == 1)
1131
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1145
+                    if ($menu_order == 1) {
1146
+                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1147
+                    }
1132 1148
 
1133 1149
                 }
1134 1150
 
@@ -1169,8 +1185,9 @@  discard block
 block discarded – undo
1169 1185
 
1170 1186
         $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1171 1187
 
1172
-        if (!empty($invalid_files))
1173
-            geodir_remove_attachments($invalid_files);
1188
+        if (!empty($invalid_files)) {
1189
+                    geodir_remove_attachments($invalid_files);
1190
+        }
1174 1191
     }
1175 1192
 
1176 1193
 }
@@ -1223,16 +1240,19 @@  discard block
 block discarded – undo
1223 1240
 function geodir_delete_directory($dirname)
1224 1241
 {
1225 1242
     $dir_handle = '';
1226
-    if (is_dir($dirname))
1227
-        $dir_handle = opendir($dirname);
1228
-    if (!$dir_handle)
1229
-        return false;
1243
+    if (is_dir($dirname)) {
1244
+            $dir_handle = opendir($dirname);
1245
+    }
1246
+    if (!$dir_handle) {
1247
+            return false;
1248
+    }
1230 1249
     while ($file = readdir($dir_handle)) {
1231 1250
         if ($file != "." && $file != "..") {
1232
-            if (!is_dir($dirname . "/" . $file))
1233
-                unlink($dirname . "/" . $file);
1234
-            else
1235
-                geodir_delete_directory($dirname . '/' . $file);
1251
+            if (!is_dir($dirname . "/" . $file)) {
1252
+                            unlink($dirname . "/" . $file);
1253
+            } else {
1254
+                            geodir_delete_directory($dirname . '/' . $file);
1255
+            }
1236 1256
         }
1237 1257
     }
1238 1258
     closedir($dir_handle);
@@ -1261,8 +1281,9 @@  discard block
 block discarded – undo
1261 1281
             foreach ($postcurr_images as $postimg) {
1262 1282
                 $image_name_arr = explode('/', $postimg->src);
1263 1283
                 $filename = end($image_name_arr);
1264
-                if (file_exists($uploads_dir . '/' . $filename))
1265
-                    unlink($uploads_dir . '/' . $filename);
1284
+                if (file_exists($uploads_dir . '/' . $filename)) {
1285
+                                    unlink($uploads_dir . '/' . $filename);
1286
+                }
1266 1287
             }
1267 1288
 
1268 1289
         } // endif
@@ -1379,9 +1400,9 @@  discard block
 block discarded – undo
1379 1400
                 $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1380 1401
             }
1381 1402
 
1382
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1383
-                $default_img = $default_catimg['src'];
1384
-            elseif ($no_image) {
1403
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1404
+                            $default_img = $default_catimg['src'];
1405
+            } elseif ($no_image) {
1385 1406
                 $default_img = get_option('geodir_listing_no_img');
1386 1407
             }
1387 1408
 
@@ -1413,10 +1434,13 @@  discard block
 block discarded – undo
1413 1434
             }
1414 1435
         }
1415 1436
 
1416
-        if (!empty($img_arr))
1417
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1418
-        else
1419
-            return false;
1437
+        if (!empty($img_arr)) {
1438
+                    return (object)$img_arr;
1439
+        }
1440
+        //return (object)array( 'src' => $file_url, 'path' => $file_path );
1441
+        else {
1442
+                    return false;
1443
+        }
1420 1444
     }
1421 1445
 }
1422 1446
 
@@ -1443,8 +1467,9 @@  discard block
 block discarded – undo
1443 1467
             echo $html;
1444 1468
         } elseif (!empty($html)) {
1445 1469
             return $html;
1446
-        } else
1447
-            return false;
1470
+        } else {
1471
+                    return false;
1472
+        }
1448 1473
     }
1449 1474
 }
1450 1475
 
@@ -1472,8 +1497,9 @@  discard block
 block discarded – undo
1472 1497
         }
1473 1498
         $not_featured = '';
1474 1499
         $sub_dir = '';
1475
-        if (!$add_featured)
1476
-            $not_featured = " AND is_featured = 0 ";
1500
+        if (!$add_featured) {
1501
+                    $not_featured = " AND is_featured = 0 ";
1502
+        }
1477 1503
 
1478 1504
         $arrImages = $wpdb->get_results(
1479 1505
             $wpdb->prepare(
@@ -1494,8 +1520,9 @@  discard block
 block discarded – undo
1494 1520
 
1495 1521
                 $file_info = pathinfo($attechment->file);
1496 1522
 
1497
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1498
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1523
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1524
+                                    $sub_dir = stripslashes_deep($file_info['dirname']);
1525
+                }
1499 1526
 
1500 1527
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1501 1528
                 $uploads_baseurl = $uploads['baseurl'];
@@ -1547,9 +1574,9 @@  discard block
 block discarded – undo
1547 1574
             $default_img = '';
1548 1575
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1549 1576
             $post_type = get_post_type($post_id);
1550
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1551
-                $default_img = $default_catimg['src'];
1552
-            elseif ($no_images) {
1577
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1578
+                            $default_img = $default_catimg['src'];
1579
+            } elseif ($no_images) {
1553 1580
                 $default_img = get_option('geodir_listing_no_img');
1554 1581
             }
1555 1582
 
@@ -1590,8 +1617,9 @@  discard block
 block discarded – undo
1590 1617
                  * @param array $return_arr The array of image objects.
1591 1618
                  */
1592 1619
                 return apply_filters('geodir_get_images_arr',$return_arr);
1593
-            } else
1594
-                return false;
1620
+            } else {
1621
+                            return false;
1622
+            }
1595 1623
         }
1596 1624
     }
1597 1625
 }
@@ -1654,8 +1682,9 @@  discard block
 block discarded – undo
1654 1682
                         $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1655 1683
                     } else if ($image->width < ($max_size->h)) {
1656 1684
                         $width_per = round((($image->width / $max_size->w) * 100), 2);
1657
-                    } else
1658
-                        $width_per = 100;
1685
+                    } else {
1686
+                                            $width_per = 100;
1687
+                    }
1659 1688
                 }
1660 1689
 
1661 1690
                 if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
@@ -1663,7 +1692,7 @@  discard block
 block discarded – undo
1663 1692
                 } else {
1664 1693
                     if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1665 1694
                         $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>';
1666
-                    }else{
1695
+                    } else{
1667 1696
                         $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
1668 1697
                     }
1669 1698
 
@@ -1675,8 +1704,9 @@  discard block
 block discarded – undo
1675 1704
             echo $html;
1676 1705
         } elseif (!empty($html)) {
1677 1706
             return $html;
1678
-        } else
1679
-            return false;
1707
+        } else {
1708
+                    return false;
1709
+        }
1680 1710
     }
1681 1711
 }
1682 1712
 
@@ -1714,8 +1744,9 @@  discard block
 block discarded – undo
1714 1744
                 $post_obj = get_post($post_id);
1715 1745
 
1716 1746
                 $cat_ids = array('0');
1717
-                if (is_array($tt_ids))
1718
-                    $cat_ids = $tt_ids;
1747
+                if (is_array($tt_ids)) {
1748
+                                    $cat_ids = $tt_ids;
1749
+                }
1719 1750
 
1720 1751
 
1721 1752
                 if (!empty($cat_ids)) {
@@ -1772,8 +1803,9 @@  discard block
 block discarded – undo
1772 1803
                         $json .= '}';
1773 1804
 
1774 1805
 
1775
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1776
-                            $post_marker_json = $json;
1806
+                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) {
1807
+                                                    $post_marker_json = $json;
1808
+                        }
1777 1809
 
1778 1810
 
1779 1811
                         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)))) {
@@ -1804,10 +1836,13 @@  discard block
 block discarded – undo
1804 1836
                 if (!empty($post_term) && is_array($post_term)) {
1805 1837
                     $categories = implode(',', $post_term);
1806 1838
 
1807
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1839
+                    if ($categories != '' && $categories != 0) {
1840
+                    	$categories = ',' . $categories . ',';
1841
+                    }
1808 1842
 
1809
-                    if (empty($post_marker_json))
1810
-                        $post_marker_json = isset($json) ? $json : '';
1843
+                    if (empty($post_marker_json)) {
1844
+                                            $post_marker_json = isset($json) ? $json : '';
1845
+                    }
1811 1846
 
1812 1847
                     if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1813 1848
 
@@ -1846,8 +1881,9 @@  discard block
 block discarded – undo
1846 1881
 
1847 1882
                                 }
1848 1883
 
1849
-                                if ($default_category == '')
1850
-                                    $default_category = $categories[0];
1884
+                                if ($default_category == '') {
1885
+                                                                    $default_category = $categories[0];
1886
+                                }
1851 1887
 
1852 1888
                                 geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1853 1889
 
@@ -1994,7 +2030,7 @@  discard block
 block discarded – undo
1994 2030
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1995 2031
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1996 2032
                             <?php
1997
-                            }else{
2033
+                            } else{
1998 2034
                                 echo '<div class="geodir-bubble_image"></div>';
1999 2035
                             }
2000 2036
                         } else {
@@ -2002,7 +2038,7 @@  discard block
 block discarded – undo
2002 2038
                                 ?>
2003 2039
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
2004 2040
                             <?php
2005
-                            }else{
2041
+                            } else{
2006 2042
                                 echo '<div class="geodir-bubble_image"></div>';
2007 2043
                             }
2008 2044
                         }
@@ -2083,10 +2119,11 @@  discard block
 block discarded – undo
2083 2119
      */
2084 2120
     function geodir_new_post_default_status()
2085 2121
     {
2086
-        if (get_option('geodir_new_post_default_status'))
2087
-            return get_option('geodir_new_post_default_status');
2088
-        else
2089
-            return 'publish';
2122
+        if (get_option('geodir_new_post_default_status')) {
2123
+                    return get_option('geodir_new_post_default_status');
2124
+        } else {
2125
+                    return 'publish';
2126
+        }
2090 2127
 
2091 2128
     }
2092 2129
 }
@@ -2237,8 +2274,9 @@  discard block
 block discarded – undo
2237 2274
 
2238 2275
         $all_postypes = geodir_get_posttypes();
2239 2276
 
2240
-        if (!in_array($post_type, $all_postypes))
2241
-            return false;
2277
+        if (!in_array($post_type, $all_postypes)) {
2278
+                    return false;
2279
+        }
2242 2280
 
2243 2281
         $table = $plugin_prefix . $post_type . '_detail';
2244 2282
 
@@ -2506,8 +2544,9 @@  discard block
 block discarded – undo
2506 2544
         $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2507 2545
 
2508 2546
         $user_meta_data = '';
2509
-        if (isset($current_user->data->ID))
2510
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2547
+        if (isset($current_user->data->ID)) {
2548
+                    $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2549
+        }
2511 2550
 
2512 2551
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2513 2552
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
@@ -2520,8 +2559,9 @@  discard block
 block discarded – undo
2520 2559
 
2521 2560
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2522 2561
                 $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2523
-            } else
2524
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2562
+            } else {
2563
+                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2564
+            }
2525 2565
 
2526 2566
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2527 2567
                                                                                         href="javascript:void(0);"
@@ -2584,14 +2624,16 @@  discard block
 block discarded – undo
2584 2624
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2585 2625
 
2586 2626
             $cat_post_count = $wpdb->get_var($count_query);
2587
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2588
-                $cat_post_count = 0;
2627
+            if (empty($cat_post_count) || is_wp_error($cat_post_count)) {
2628
+                            $cat_post_count = 0;
2629
+            }
2589 2630
 
2590 2631
             return $cat_post_count;
2591 2632
 
2592
-        } else
2593
-
2594
-            return $term->count;
2633
+        } else {
2634
+        
2635
+            return $term->count;
2636
+        }
2595 2637
     }
2596 2638
     return false;
2597 2639
 
@@ -2638,13 +2680,15 @@  discard block
 block discarded – undo
2638 2680
 		return $length;
2639 2681
 	}
2640 2682
 	
2641
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2642
-        $length = get_option('geodir_desc_word_limit');
2643
-    elseif (get_query_var('excerpt_length'))
2644
-        $length = get_query_var('excerpt_length');
2683
+    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) {
2684
+            $length = get_option('geodir_desc_word_limit');
2685
+    } elseif (get_query_var('excerpt_length')) {
2686
+            $length = get_query_var('excerpt_length');
2687
+    }
2645 2688
 
2646
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2647
-        $length = get_option('geodir_author_desc_word_limit');
2689
+    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) {
2690
+            $length = get_option('geodir_author_desc_word_limit');
2691
+    }
2648 2692
 
2649 2693
     return $length;
2650 2694
 }
@@ -2777,10 +2821,11 @@  discard block
 block discarded – undo
2777 2821
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2778 2822
 {
2779 2823
     $listing_author_id = geodir_get_listing_author($listing_id);
2780
-    if ($listing_author_id == $user_id)
2781
-        return true;
2782
-    else
2783
-        return false;
2824
+    if ($listing_author_id == $user_id) {
2825
+            return true;
2826
+    } else {
2827
+            return false;
2828
+    }
2784 2829
 
2785 2830
 }
2786 2831
 
@@ -2829,10 +2874,11 @@  discard block
 block discarded – undo
2829 2874
     $pattern = '/-\d+x\d+\./';
2830 2875
     preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2831 2876
 
2832
-    if (empty($matches))
2833
-        return '';
2834
-    else
2835
-        return $file;
2877
+    if (empty($matches)) {
2878
+            return '';
2879
+    } else {
2880
+            return $file;
2881
+    }
2836 2882
 
2837 2883
 }
2838 2884
 
@@ -2917,8 +2963,9 @@  discard block
 block discarded – undo
2917 2963
     } else {
2918 2964
         //set_post_thumbnail($post_id,-1);
2919 2965
 
2920
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2921
-            wp_delete_attachment($post_thumbnail_id);
2966
+        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2967
+                    wp_delete_attachment($post_thumbnail_id);
2968
+        }
2922 2969
 
2923 2970
     }
2924 2971
 }
@@ -3003,8 +3050,9 @@  discard block
 block discarded – undo
3003 3050
 
3004 3051
     global $wpdb;
3005 3052
 
3006
-    if ($listing_type == '')
3007
-        $listing_type = 'gd_place';
3053
+    if ($listing_type == '') {
3054
+            $listing_type = 'gd_place';
3055
+    }
3008 3056
 
3009 3057
     $fields_info = array();
3010 3058
 
@@ -3027,8 +3075,9 @@  discard block
 block discarded – undo
3027 3075
 
3028 3076
                 $fields_info[$prefix . 'address'] = $data->field_type;
3029 3077
 
3030
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
3031
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
3078
+                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
3079
+                                    $fields_info[$prefix . 'zip'] = $data->field_type;
3080
+                }
3032 3081
 
3033 3082
             } else {
3034 3083
 
Please login to merge, or discard this patch.