@@ -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)){
|
@@ -372,8 +373,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,8 +875,9 @@ discard block |
||
| 862 | 875 | |
| 863 | 876 | if ($meta_value && $meta_value !== '') {
|
| 864 | 877 | return maybe_serialize($meta_value); |
| 865 | - } else |
|
| 866 | - return $meta_value; |
|
| 878 | + } else { |
|
| 879 | + return $meta_value; |
|
| 880 | + } |
|
| 867 | 881 | } else {
|
| 868 | 882 | return false; |
| 869 | 883 | } |
@@ -997,7 +1011,7 @@ discard block |
||
| 997 | 1011 | if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
| 998 | 1012 | $new_name = basename($uploaded['file']); |
| 999 | 1013 | $uploaded_file = $uploaded; |
| 1000 | - }else{
|
|
| 1014 | + } else{
|
|
| 1001 | 1015 | print_r($uploaded);exit; |
| 1002 | 1016 | } |
| 1003 | 1017 | $external_img = false; |
@@ -1022,8 +1036,9 @@ discard block |
||
| 1022 | 1036 | $file_path = $curr_img_dir . '/' . $filename; |
| 1023 | 1037 | } |
| 1024 | 1038 | |
| 1025 | - if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
|
| 1026 | - unlink($img_path); |
|
| 1039 | + if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) { |
|
| 1040 | + unlink($img_path); |
|
| 1041 | + } |
|
| 1027 | 1042 | } |
| 1028 | 1043 | |
| 1029 | 1044 | if (!empty($uploaded_file)) {
|
@@ -1052,8 +1067,9 @@ discard block |
||
| 1052 | 1067 | $attachment_set = ''; |
| 1053 | 1068 | |
| 1054 | 1069 | foreach ($attachment as $key => $val) {
|
| 1055 | - if ($val != '') |
|
| 1056 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1070 | + if ($val != '') { |
|
| 1071 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1072 | + } |
|
| 1057 | 1073 | } |
| 1058 | 1074 | |
| 1059 | 1075 | $attachment_set = trim($attachment_set, ", "); |
@@ -1078,8 +1094,9 @@ discard block |
||
| 1078 | 1094 | ) |
| 1079 | 1095 | ); |
| 1080 | 1096 | |
| 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)));
|
|
| 1097 | + if ($menu_order == 1) { |
|
| 1098 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id))); |
|
| 1099 | + } |
|
| 1083 | 1100 | |
| 1084 | 1101 | } |
| 1085 | 1102 | |
@@ -1120,8 +1137,9 @@ discard block |
||
| 1120 | 1137 | |
| 1121 | 1138 | $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
| 1122 | 1139 | |
| 1123 | - if (!empty($invalid_files)) |
|
| 1124 | - geodir_remove_attachments($invalid_files); |
|
| 1140 | + if (!empty($invalid_files)) { |
|
| 1141 | + geodir_remove_attachments($invalid_files); |
|
| 1142 | + } |
|
| 1125 | 1143 | } |
| 1126 | 1144 | |
| 1127 | 1145 | } |
@@ -1174,16 +1192,19 @@ discard block |
||
| 1174 | 1192 | function geodir_delete_directory($dirname) |
| 1175 | 1193 | {
|
| 1176 | 1194 | $dir_handle = ''; |
| 1177 | - if (is_dir($dirname)) |
|
| 1178 | - $dir_handle = opendir($dirname); |
|
| 1179 | - if (!$dir_handle) |
|
| 1180 | - return false; |
|
| 1195 | + if (is_dir($dirname)) { |
|
| 1196 | + $dir_handle = opendir($dirname); |
|
| 1197 | + } |
|
| 1198 | + if (!$dir_handle) { |
|
| 1199 | + return false; |
|
| 1200 | + } |
|
| 1181 | 1201 | while ($file = readdir($dir_handle)) {
|
| 1182 | 1202 | if ($file != "." && $file != "..") {
|
| 1183 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1184 | - unlink($dirname . "/" . $file); |
|
| 1185 | - else |
|
| 1186 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1203 | + if (!is_dir($dirname . "/" . $file)) { |
|
| 1204 | + unlink($dirname . "/" . $file); |
|
| 1205 | + } else { |
|
| 1206 | + geodir_delete_directory($dirname . '/' . $file); |
|
| 1207 | + } |
|
| 1187 | 1208 | } |
| 1188 | 1209 | } |
| 1189 | 1210 | closedir($dir_handle); |
@@ -1212,8 +1233,9 @@ discard block |
||
| 1212 | 1233 | foreach ($postcurr_images as $postimg) {
|
| 1213 | 1234 | $image_name_arr = explode('/', $postimg->src);
|
| 1214 | 1235 | $filename = end($image_name_arr); |
| 1215 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1216 | - unlink($uploads_dir . '/' . $filename); |
|
| 1236 | + if (file_exists($uploads_dir . '/' . $filename)) { |
|
| 1237 | + unlink($uploads_dir . '/' . $filename); |
|
| 1238 | + } |
|
| 1217 | 1239 | } |
| 1218 | 1240 | |
| 1219 | 1241 | } // endif |
@@ -1265,8 +1287,9 @@ discard block |
||
| 1265 | 1287 | |
| 1266 | 1288 | $file_info = pathinfo($file); |
| 1267 | 1289 | $sub_dir = ''; |
| 1268 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1269 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1290 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 1291 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1292 | + } |
|
| 1270 | 1293 | |
| 1271 | 1294 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 1272 | 1295 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1310,9 +1333,9 @@ discard block |
||
| 1310 | 1333 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
| 1311 | 1334 | } |
| 1312 | 1335 | |
| 1313 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1314 | - $default_img = $default_catimg['src']; |
|
| 1315 | - elseif ($no_image) {
|
|
| 1336 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
| 1337 | + $default_img = $default_catimg['src']; |
|
| 1338 | + } elseif ($no_image) {
|
|
| 1316 | 1339 | $default_img = get_option('geodir_listing_no_img');
|
| 1317 | 1340 | } |
| 1318 | 1341 | |
@@ -1344,10 +1367,13 @@ discard block |
||
| 1344 | 1367 | } |
| 1345 | 1368 | } |
| 1346 | 1369 | |
| 1347 | - if (!empty($img_arr)) |
|
| 1348 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1349 | - else |
|
| 1350 | - return false; |
|
| 1370 | + if (!empty($img_arr)) { |
|
| 1371 | + return (object)$img_arr; |
|
| 1372 | + } |
|
| 1373 | + //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1374 | + else { |
|
| 1375 | + return false; |
|
| 1376 | + } |
|
| 1351 | 1377 | } |
| 1352 | 1378 | } |
| 1353 | 1379 | |
@@ -1374,8 +1400,9 @@ discard block |
||
| 1374 | 1400 | echo $html; |
| 1375 | 1401 | } elseif (!empty($html)) {
|
| 1376 | 1402 | return $html; |
| 1377 | - } else |
|
| 1378 | - return false; |
|
| 1403 | + } else { |
|
| 1404 | + return false; |
|
| 1405 | + } |
|
| 1379 | 1406 | } |
| 1380 | 1407 | } |
| 1381 | 1408 | |
@@ -1403,8 +1430,9 @@ discard block |
||
| 1403 | 1430 | } |
| 1404 | 1431 | $not_featured = ''; |
| 1405 | 1432 | $sub_dir = ''; |
| 1406 | - if (!$add_featured) |
|
| 1407 | - $not_featured = " AND is_featured = 0 "; |
|
| 1433 | + if (!$add_featured) { |
|
| 1434 | + $not_featured = " AND is_featured = 0 "; |
|
| 1435 | + } |
|
| 1408 | 1436 | |
| 1409 | 1437 | $arrImages = $wpdb->get_results( |
| 1410 | 1438 | $wpdb->prepare( |
@@ -1425,8 +1453,9 @@ discard block |
||
| 1425 | 1453 | |
| 1426 | 1454 | $file_info = pathinfo($attechment->file); |
| 1427 | 1455 | |
| 1428 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1429 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1456 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 1457 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1458 | + } |
|
| 1430 | 1459 | |
| 1431 | 1460 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 1432 | 1461 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1471,9 +1500,9 @@ discard block |
||
| 1471 | 1500 | $default_img = ''; |
| 1472 | 1501 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
| 1473 | 1502 | $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) {
|
|
| 1503 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
| 1504 | + $default_img = $default_catimg['src']; |
|
| 1505 | + } elseif ($no_images) {
|
|
| 1477 | 1506 | $default_img = get_option('geodir_listing_no_img');
|
| 1478 | 1507 | } |
| 1479 | 1508 | |
@@ -1508,8 +1537,9 @@ discard block |
||
| 1508 | 1537 | $return_arr[] = (object)$img_arr; |
| 1509 | 1538 | |
| 1510 | 1539 | return $return_arr; |
| 1511 | - } else |
|
| 1512 | - return false; |
|
| 1540 | + } else { |
|
| 1541 | + return false; |
|
| 1542 | + } |
|
| 1513 | 1543 | } |
| 1514 | 1544 | } |
| 1515 | 1545 | } |
@@ -1570,8 +1600,9 @@ discard block |
||
| 1570 | 1600 | $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
| 1571 | 1601 | } else if ($image->width < ($max_size->h)) {
|
| 1572 | 1602 | $width_per = round((($image->width / $max_size->w) * 100), 2); |
| 1573 | - } else |
|
| 1574 | - $width_per = 100; |
|
| 1603 | + } else { |
|
| 1604 | + $width_per = 100; |
|
| 1605 | + } |
|
| 1575 | 1606 | } |
| 1576 | 1607 | |
| 1577 | 1608 | if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
@@ -1586,8 +1617,9 @@ discard block |
||
| 1586 | 1617 | echo $html; |
| 1587 | 1618 | } elseif (!empty($html)) {
|
| 1588 | 1619 | return $html; |
| 1589 | - } else |
|
| 1590 | - return false; |
|
| 1620 | + } else { |
|
| 1621 | + return false; |
|
| 1622 | + } |
|
| 1591 | 1623 | } |
| 1592 | 1624 | } |
| 1593 | 1625 | |
@@ -1625,8 +1657,9 @@ discard block |
||
| 1625 | 1657 | $post_obj = get_post($post_id); |
| 1626 | 1658 | |
| 1627 | 1659 | $cat_ids = array('0');
|
| 1628 | - if (is_array($tt_ids)) |
|
| 1629 | - $cat_ids = $tt_ids; |
|
| 1660 | + if (is_array($tt_ids)) { |
|
| 1661 | + $cat_ids = $tt_ids; |
|
| 1662 | + } |
|
| 1630 | 1663 | |
| 1631 | 1664 | |
| 1632 | 1665 | if (!empty($cat_ids)) {
|
@@ -1683,8 +1716,9 @@ discard block |
||
| 1683 | 1716 | $json .= '}'; |
| 1684 | 1717 | |
| 1685 | 1718 | |
| 1686 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
| 1687 | - $post_marker_json = $json; |
|
| 1719 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) { |
|
| 1720 | + $post_marker_json = $json; |
|
| 1721 | + } |
|
| 1688 | 1722 | |
| 1689 | 1723 | |
| 1690 | 1724 | 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 +1749,13 @@ discard block |
||
| 1715 | 1749 | if (!empty($post_term) && is_array($post_term)) {
|
| 1716 | 1750 | $categories = implode(',', $post_term);
|
| 1717 | 1751 | |
| 1718 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1752 | + if ($categories != '' && $categories != 0) { |
|
| 1753 | + $categories = ',' . $categories . ','; |
|
| 1754 | + } |
|
| 1719 | 1755 | |
| 1720 | - if (empty($post_marker_json)) |
|
| 1721 | - $post_marker_json = isset($json) ? $json : ''; |
|
| 1756 | + if (empty($post_marker_json)) { |
|
| 1757 | + $post_marker_json = isset($json) ? $json : ''; |
|
| 1758 | + } |
|
| 1722 | 1759 | |
| 1723 | 1760 | if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
| 1724 | 1761 | |
@@ -1757,8 +1794,9 @@ discard block |
||
| 1757 | 1794 | |
| 1758 | 1795 | } |
| 1759 | 1796 | |
| 1760 | - if ($default_category == '') |
|
| 1761 | - $default_category = $categories[0]; |
|
| 1797 | + if ($default_category == '') { |
|
| 1798 | + $default_category = $categories[0]; |
|
| 1799 | + } |
|
| 1762 | 1800 | |
| 1763 | 1801 | geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
| 1764 | 1802 | |
@@ -1902,7 +1940,7 @@ discard block |
||
| 1902 | 1940 | } ?>"><img alt="bubble image" style="max-height:50px;" |
| 1903 | 1941 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1904 | 1942 | <?php |
| 1905 | - }else{
|
|
| 1943 | + } else{
|
|
| 1906 | 1944 | echo '<div class="geodir-bubble_image"></div>'; |
| 1907 | 1945 | } |
| 1908 | 1946 | } else {
|
@@ -1910,7 +1948,7 @@ discard block |
||
| 1910 | 1948 | ?> |
| 1911 | 1949 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 1912 | 1950 | <?php |
| 1913 | - }else{
|
|
| 1951 | + } else{
|
|
| 1914 | 1952 | echo '<div class="geodir-bubble_image"></div>'; |
| 1915 | 1953 | } |
| 1916 | 1954 | } |
@@ -2001,10 +2039,11 @@ discard block |
||
| 2001 | 2039 | */ |
| 2002 | 2040 | function geodir_new_post_default_status() |
| 2003 | 2041 | {
|
| 2004 | - if (get_option('geodir_new_post_default_status'))
|
|
| 2005 | - return get_option('geodir_new_post_default_status');
|
|
| 2006 | - else |
|
| 2007 | - return 'publish'; |
|
| 2042 | + if (get_option('geodir_new_post_default_status')) { |
|
| 2043 | + return get_option('geodir_new_post_default_status'); |
|
| 2044 | + } else { |
|
| 2045 | + return 'publish'; |
|
| 2046 | + } |
|
| 2008 | 2047 | |
| 2009 | 2048 | } |
| 2010 | 2049 | } |
@@ -2155,8 +2194,9 @@ discard block |
||
| 2155 | 2194 | |
| 2156 | 2195 | $all_postypes = geodir_get_posttypes(); |
| 2157 | 2196 | |
| 2158 | - if (!in_array($post_type, $all_postypes)) |
|
| 2159 | - return false; |
|
| 2197 | + if (!in_array($post_type, $all_postypes)) { |
|
| 2198 | + return false; |
|
| 2199 | + } |
|
| 2160 | 2200 | |
| 2161 | 2201 | $table = $plugin_prefix . $post_type . '_detail'; |
| 2162 | 2202 | |
@@ -2424,8 +2464,9 @@ discard block |
||
| 2424 | 2464 | $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
|
| 2425 | 2465 | |
| 2426 | 2466 | $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); |
|
| 2467 | + if (isset($current_user->data->ID)) { |
|
| 2468 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2469 | + } |
|
| 2429 | 2470 | |
| 2430 | 2471 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
| 2431 | 2472 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
@@ -2438,8 +2479,9 @@ discard block |
||
| 2438 | 2479 | |
| 2439 | 2480 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
| 2440 | 2481 | $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
| 2441 | - } else |
|
| 2442 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2482 | + } else { |
|
| 2483 | + $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
| 2484 | + } |
|
| 2443 | 2485 | |
| 2444 | 2486 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
| 2445 | 2487 | href="javascript:void(0);" |
@@ -2502,14 +2544,16 @@ discard block |
||
| 2502 | 2544 | WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
| 2503 | 2545 | |
| 2504 | 2546 | $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; |
|
| 2547 | + if (empty($cat_post_count) || is_wp_error($cat_post_count)) { |
|
| 2548 | + $cat_post_count = 0; |
|
| 2549 | + } |
|
| 2507 | 2550 | |
| 2508 | 2551 | return $cat_post_count; |
| 2509 | 2552 | |
| 2510 | - } else |
|
| 2511 | - |
|
| 2512 | - return $term->count; |
|
| 2553 | + } else { |
|
| 2554 | + |
|
| 2555 | + return $term->count; |
|
| 2556 | + } |
|
| 2513 | 2557 | } |
| 2514 | 2558 | return false; |
| 2515 | 2559 | |
@@ -2556,13 +2600,15 @@ discard block |
||
| 2556 | 2600 | return $length; |
| 2557 | 2601 | } |
| 2558 | 2602 | |
| 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');
|
|
| 2603 | + if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) { |
|
| 2604 | + $length = get_option('geodir_desc_word_limit'); |
|
| 2605 | + } elseif (get_query_var('excerpt_length')) { |
|
| 2606 | + $length = get_query_var('excerpt_length'); |
|
| 2607 | + } |
|
| 2563 | 2608 | |
| 2564 | - if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
|
|
| 2565 | - $length = get_option('geodir_author_desc_word_limit');
|
|
| 2609 | + if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) { |
|
| 2610 | + $length = get_option('geodir_author_desc_word_limit'); |
|
| 2611 | + } |
|
| 2566 | 2612 | |
| 2567 | 2613 | return $length; |
| 2568 | 2614 | } |
@@ -2695,10 +2741,11 @@ discard block |
||
| 2695 | 2741 | function geodir_lisiting_belong_to_user($listing_id, $user_id) |
| 2696 | 2742 | {
|
| 2697 | 2743 | $listing_author_id = geodir_get_listing_author($listing_id); |
| 2698 | - if ($listing_author_id == $user_id) |
|
| 2699 | - return true; |
|
| 2700 | - else |
|
| 2701 | - return false; |
|
| 2744 | + if ($listing_author_id == $user_id) { |
|
| 2745 | + return true; |
|
| 2746 | + } else { |
|
| 2747 | + return false; |
|
| 2748 | + } |
|
| 2702 | 2749 | |
| 2703 | 2750 | } |
| 2704 | 2751 | |
@@ -2747,10 +2794,11 @@ discard block |
||
| 2747 | 2794 | $pattern = '/-\d+x\d+\./'; |
| 2748 | 2795 | preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
| 2749 | 2796 | |
| 2750 | - if (empty($matches)) |
|
| 2751 | - return ''; |
|
| 2752 | - else |
|
| 2753 | - return $file; |
|
| 2797 | + if (empty($matches)) { |
|
| 2798 | + return ''; |
|
| 2799 | + } else { |
|
| 2800 | + return $file; |
|
| 2801 | + } |
|
| 2754 | 2802 | |
| 2755 | 2803 | } |
| 2756 | 2804 | |
@@ -2835,8 +2883,9 @@ discard block |
||
| 2835 | 2883 | } else {
|
| 2836 | 2884 | //set_post_thumbnail($post_id,-1); |
| 2837 | 2885 | |
| 2838 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
| 2839 | - wp_delete_attachment($post_thumbnail_id); |
|
| 2886 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) { |
|
| 2887 | + wp_delete_attachment($post_thumbnail_id); |
|
| 2888 | + } |
|
| 2840 | 2889 | |
| 2841 | 2890 | } |
| 2842 | 2891 | } |
@@ -2921,8 +2970,9 @@ discard block |
||
| 2921 | 2970 | |
| 2922 | 2971 | global $wpdb; |
| 2923 | 2972 | |
| 2924 | - if ($listing_type == '') |
|
| 2925 | - $listing_type = 'gd_place'; |
|
| 2973 | + if ($listing_type == '') { |
|
| 2974 | + $listing_type = 'gd_place'; |
|
| 2975 | + } |
|
| 2926 | 2976 | |
| 2927 | 2977 | $fields_info = array(); |
| 2928 | 2978 | |
@@ -2945,8 +2995,9 @@ discard block |
||
| 2945 | 2995 | |
| 2946 | 2996 | $fields_info[$prefix . 'address'] = $data->field_type; |
| 2947 | 2997 | |
| 2948 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
| 2949 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 2998 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 2999 | + $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3000 | + } |
|
| 2950 | 3001 | |
| 2951 | 3002 | } else {
|
| 2952 | 3003 | |