@@ -21,12 +21,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1358,9 +1380,9 @@ discard block |
||
1358 | 1380 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
1359 | 1381 | } |
1360 | 1382 | |
1361 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
1362 | - $default_img = $default_catimg['src']; |
|
1363 | - elseif ($no_image) { |
|
1383 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
1384 | + $default_img = $default_catimg['src']; |
|
1385 | + } elseif ($no_image) { |
|
1364 | 1386 | $default_img = get_option('geodir_listing_no_img'); |
1365 | 1387 | } |
1366 | 1388 | |
@@ -1392,10 +1414,13 @@ discard block |
||
1392 | 1414 | } |
1393 | 1415 | } |
1394 | 1416 | |
1395 | - if (!empty($img_arr)) |
|
1396 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
1397 | - else |
|
1398 | - return false; |
|
1417 | + if (!empty($img_arr)) { |
|
1418 | + return (object)$img_arr; |
|
1419 | + } |
|
1420 | + //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
1421 | + else { |
|
1422 | + return false; |
|
1423 | + } |
|
1399 | 1424 | } |
1400 | 1425 | } |
1401 | 1426 | |
@@ -1422,8 +1447,9 @@ discard block |
||
1422 | 1447 | echo $html; |
1423 | 1448 | } elseif (!empty($html)) { |
1424 | 1449 | return $html; |
1425 | - } else |
|
1426 | - return false; |
|
1450 | + } else { |
|
1451 | + return false; |
|
1452 | + } |
|
1427 | 1453 | } |
1428 | 1454 | } |
1429 | 1455 | |
@@ -1451,8 +1477,9 @@ discard block |
||
1451 | 1477 | } |
1452 | 1478 | $not_featured = ''; |
1453 | 1479 | $sub_dir = ''; |
1454 | - if (!$add_featured) |
|
1455 | - $not_featured = " AND is_featured = 0 "; |
|
1480 | + if (!$add_featured) { |
|
1481 | + $not_featured = " AND is_featured = 0 "; |
|
1482 | + } |
|
1456 | 1483 | |
1457 | 1484 | $arrImages = $wpdb->get_results( |
1458 | 1485 | $wpdb->prepare( |
@@ -1473,8 +1500,9 @@ discard block |
||
1473 | 1500 | |
1474 | 1501 | $file_info = pathinfo($attechment->file); |
1475 | 1502 | |
1476 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
1477 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
1503 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
1504 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
1505 | + } |
|
1478 | 1506 | |
1479 | 1507 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
1480 | 1508 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1519,9 +1547,9 @@ discard block |
||
1519 | 1547 | $default_img = ''; |
1520 | 1548 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
1521 | 1549 | $post_type = get_post_type($post_id); |
1522 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
1523 | - $default_img = $default_catimg['src']; |
|
1524 | - elseif ($no_images) { |
|
1550 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
1551 | + $default_img = $default_catimg['src']; |
|
1552 | + } elseif ($no_images) { |
|
1525 | 1553 | $default_img = get_option('geodir_listing_no_img'); |
1526 | 1554 | } |
1527 | 1555 | |
@@ -1556,8 +1584,9 @@ discard block |
||
1556 | 1584 | $return_arr[] = (object)$img_arr; |
1557 | 1585 | |
1558 | 1586 | return $return_arr; |
1559 | - } else |
|
1560 | - return false; |
|
1587 | + } else { |
|
1588 | + return false; |
|
1589 | + } |
|
1561 | 1590 | } |
1562 | 1591 | } |
1563 | 1592 | } |
@@ -1618,8 +1647,9 @@ discard block |
||
1618 | 1647 | $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
1619 | 1648 | } else if ($image->width < ($max_size->h)) { |
1620 | 1649 | $width_per = round((($image->width / $max_size->w) * 100), 2); |
1621 | - } else |
|
1622 | - $width_per = 100; |
|
1650 | + } else { |
|
1651 | + $width_per = 100; |
|
1652 | + } |
|
1623 | 1653 | } |
1624 | 1654 | |
1625 | 1655 | if (is_admin() && !isset($_REQUEST['geodir_ajax'])){ |
@@ -1627,7 +1657,7 @@ discard block |
||
1627 | 1657 | } else { |
1628 | 1658 | if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){ |
1629 | 1659 | $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
1630 | - }else{ |
|
1660 | + } else{ |
|
1631 | 1661 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
1632 | 1662 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>'; |
1633 | 1663 | $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>'; |
@@ -1642,8 +1672,9 @@ discard block |
||
1642 | 1672 | echo $html; |
1643 | 1673 | } elseif (!empty($html)) { |
1644 | 1674 | return $html; |
1645 | - } else |
|
1646 | - return false; |
|
1675 | + } else { |
|
1676 | + return false; |
|
1677 | + } |
|
1647 | 1678 | } |
1648 | 1679 | } |
1649 | 1680 | |
@@ -1681,8 +1712,9 @@ discard block |
||
1681 | 1712 | $post_obj = get_post($post_id); |
1682 | 1713 | |
1683 | 1714 | $cat_ids = array('0'); |
1684 | - if (is_array($tt_ids)) |
|
1685 | - $cat_ids = $tt_ids; |
|
1715 | + if (is_array($tt_ids)) { |
|
1716 | + $cat_ids = $tt_ids; |
|
1717 | + } |
|
1686 | 1718 | |
1687 | 1719 | |
1688 | 1720 | if (!empty($cat_ids)) { |
@@ -1739,8 +1771,9 @@ discard block |
||
1739 | 1771 | $json .= '}'; |
1740 | 1772 | |
1741 | 1773 | |
1742 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
1743 | - $post_marker_json = $json; |
|
1774 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) { |
|
1775 | + $post_marker_json = $json; |
|
1776 | + } |
|
1744 | 1777 | |
1745 | 1778 | |
1746 | 1779 | 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)))) { |
@@ -1771,10 +1804,13 @@ discard block |
||
1771 | 1804 | if (!empty($post_term) && is_array($post_term)) { |
1772 | 1805 | $categories = implode(',', $post_term); |
1773 | 1806 | |
1774 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
1807 | + if ($categories != '' && $categories != 0) { |
|
1808 | + $categories = ',' . $categories . ','; |
|
1809 | + } |
|
1775 | 1810 | |
1776 | - if (empty($post_marker_json)) |
|
1777 | - $post_marker_json = isset($json) ? $json : ''; |
|
1811 | + if (empty($post_marker_json)) { |
|
1812 | + $post_marker_json = isset($json) ? $json : ''; |
|
1813 | + } |
|
1778 | 1814 | |
1779 | 1815 | if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) { |
1780 | 1816 | |
@@ -1813,8 +1849,9 @@ discard block |
||
1813 | 1849 | |
1814 | 1850 | } |
1815 | 1851 | |
1816 | - if ($default_category == '') |
|
1817 | - $default_category = $categories[0]; |
|
1852 | + if ($default_category == '') { |
|
1853 | + $default_category = $categories[0]; |
|
1854 | + } |
|
1818 | 1855 | |
1819 | 1856 | geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
1820 | 1857 | |
@@ -1955,7 +1992,7 @@ discard block |
||
1955 | 1992 | } ?>"><img alt="bubble image" style="max-height:50px;" |
1956 | 1993 | src="<?php echo $post_images[0]; ?>"/></a></div> |
1957 | 1994 | <?php |
1958 | - }else{ |
|
1995 | + } else{ |
|
1959 | 1996 | echo '<div class="geodir-bubble_image"></div>'; |
1960 | 1997 | } |
1961 | 1998 | } else { |
@@ -1963,7 +2000,7 @@ discard block |
||
1963 | 2000 | ?> |
1964 | 2001 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
1965 | 2002 | <?php |
1966 | - }else{ |
|
2003 | + } else{ |
|
1967 | 2004 | echo '<div class="geodir-bubble_image"></div>'; |
1968 | 2005 | } |
1969 | 2006 | } |
@@ -2044,10 +2081,11 @@ discard block |
||
2044 | 2081 | */ |
2045 | 2082 | function geodir_new_post_default_status() |
2046 | 2083 | { |
2047 | - if (get_option('geodir_new_post_default_status')) |
|
2048 | - return get_option('geodir_new_post_default_status'); |
|
2049 | - else |
|
2050 | - return 'publish'; |
|
2084 | + if (get_option('geodir_new_post_default_status')) { |
|
2085 | + return get_option('geodir_new_post_default_status'); |
|
2086 | + } else { |
|
2087 | + return 'publish'; |
|
2088 | + } |
|
2051 | 2089 | |
2052 | 2090 | } |
2053 | 2091 | } |
@@ -2198,8 +2236,9 @@ discard block |
||
2198 | 2236 | |
2199 | 2237 | $all_postypes = geodir_get_posttypes(); |
2200 | 2238 | |
2201 | - if (!in_array($post_type, $all_postypes)) |
|
2202 | - return false; |
|
2239 | + if (!in_array($post_type, $all_postypes)) { |
|
2240 | + return false; |
|
2241 | + } |
|
2203 | 2242 | |
2204 | 2243 | $table = $plugin_prefix . $post_type . '_detail'; |
2205 | 2244 | |
@@ -2467,8 +2506,9 @@ discard block |
||
2467 | 2506 | $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart'); |
2468 | 2507 | |
2469 | 2508 | $user_meta_data = ''; |
2470 | - if (isset($current_user->data->ID)) |
|
2471 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
2509 | + if (isset($current_user->data->ID)) { |
|
2510 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
2511 | + } |
|
2472 | 2512 | |
2473 | 2513 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) { |
2474 | 2514 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
@@ -2481,8 +2521,9 @@ discard block |
||
2481 | 2521 | |
2482 | 2522 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') { |
2483 | 2523 | $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
2484 | - } else |
|
2485 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
2524 | + } else { |
|
2525 | + $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
2526 | + } |
|
2486 | 2527 | |
2487 | 2528 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
2488 | 2529 | href="javascript:void(0);" |
@@ -2545,14 +2586,16 @@ discard block |
||
2545 | 2586 | WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where; |
2546 | 2587 | |
2547 | 2588 | $cat_post_count = $wpdb->get_var($count_query); |
2548 | - if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
|
2549 | - $cat_post_count = 0; |
|
2589 | + if (empty($cat_post_count) || is_wp_error($cat_post_count)) { |
|
2590 | + $cat_post_count = 0; |
|
2591 | + } |
|
2550 | 2592 | |
2551 | 2593 | return $cat_post_count; |
2552 | 2594 | |
2553 | - } else |
|
2554 | - |
|
2555 | - return $term->count; |
|
2595 | + } else { |
|
2596 | + |
|
2597 | + return $term->count; |
|
2598 | + } |
|
2556 | 2599 | } |
2557 | 2600 | return false; |
2558 | 2601 | |
@@ -2599,13 +2642,15 @@ discard block |
||
2599 | 2642 | return $length; |
2600 | 2643 | } |
2601 | 2644 | |
2602 | - if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) |
|
2603 | - $length = get_option('geodir_desc_word_limit'); |
|
2604 | - elseif (get_query_var('excerpt_length')) |
|
2605 | - $length = get_query_var('excerpt_length'); |
|
2645 | + if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) { |
|
2646 | + $length = get_option('geodir_desc_word_limit'); |
|
2647 | + } elseif (get_query_var('excerpt_length')) { |
|
2648 | + $length = get_query_var('excerpt_length'); |
|
2649 | + } |
|
2606 | 2650 | |
2607 | - if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) |
|
2608 | - $length = get_option('geodir_author_desc_word_limit'); |
|
2651 | + if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) { |
|
2652 | + $length = get_option('geodir_author_desc_word_limit'); |
|
2653 | + } |
|
2609 | 2654 | |
2610 | 2655 | return $length; |
2611 | 2656 | } |
@@ -2738,10 +2783,11 @@ discard block |
||
2738 | 2783 | function geodir_lisiting_belong_to_user($listing_id, $user_id) |
2739 | 2784 | { |
2740 | 2785 | $listing_author_id = geodir_get_listing_author($listing_id); |
2741 | - if ($listing_author_id == $user_id) |
|
2742 | - return true; |
|
2743 | - else |
|
2744 | - return false; |
|
2786 | + if ($listing_author_id == $user_id) { |
|
2787 | + return true; |
|
2788 | + } else { |
|
2789 | + return false; |
|
2790 | + } |
|
2745 | 2791 | |
2746 | 2792 | } |
2747 | 2793 | |
@@ -2790,10 +2836,11 @@ discard block |
||
2790 | 2836 | $pattern = '/-\d+x\d+\./'; |
2791 | 2837 | preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
2792 | 2838 | |
2793 | - if (empty($matches)) |
|
2794 | - return ''; |
|
2795 | - else |
|
2796 | - return $file; |
|
2839 | + if (empty($matches)) { |
|
2840 | + return ''; |
|
2841 | + } else { |
|
2842 | + return $file; |
|
2843 | + } |
|
2797 | 2844 | |
2798 | 2845 | } |
2799 | 2846 | |
@@ -2878,8 +2925,9 @@ discard block |
||
2878 | 2925 | } else { |
2879 | 2926 | //set_post_thumbnail($post_id,-1); |
2880 | 2927 | |
2881 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
2882 | - wp_delete_attachment($post_thumbnail_id); |
|
2928 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) { |
|
2929 | + wp_delete_attachment($post_thumbnail_id); |
|
2930 | + } |
|
2883 | 2931 | |
2884 | 2932 | } |
2885 | 2933 | } |
@@ -2964,8 +3012,9 @@ discard block |
||
2964 | 3012 | |
2965 | 3013 | global $wpdb; |
2966 | 3014 | |
2967 | - if ($listing_type == '') |
|
2968 | - $listing_type = 'gd_place'; |
|
3015 | + if ($listing_type == '') { |
|
3016 | + $listing_type = 'gd_place'; |
|
3017 | + } |
|
2969 | 3018 | |
2970 | 3019 | $fields_info = array(); |
2971 | 3020 | |
@@ -2988,8 +3037,9 @@ discard block |
||
2988 | 3037 | |
2989 | 3038 | $fields_info[$prefix . 'address'] = $data->field_type; |
2990 | 3039 | |
2991 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
2992 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
3040 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
3041 | + $fields_info[$prefix . 'zip'] = $data->field_type; |
|
3042 | + } |
|
2993 | 3043 | |
2994 | 3044 | } else { |
2995 | 3045 |