@@ -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 |
@@ -1272,8 +1294,9 @@ discard block |
||
1272 | 1294 | |
1273 | 1295 | $file_info = pathinfo($file); |
1274 | 1296 | $sub_dir = ''; |
1275 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
1276 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
1297 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
1298 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
1299 | + } |
|
1277 | 1300 | |
1278 | 1301 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
1279 | 1302 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1317,9 +1340,9 @@ discard block |
||
1317 | 1340 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
1318 | 1341 | } |
1319 | 1342 | |
1320 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
1321 | - $default_img = $default_catimg['src']; |
|
1322 | - elseif ($no_image) { |
|
1343 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
1344 | + $default_img = $default_catimg['src']; |
|
1345 | + } elseif ($no_image) { |
|
1323 | 1346 | $default_img = get_option('geodir_listing_no_img'); |
1324 | 1347 | } |
1325 | 1348 | |
@@ -1351,10 +1374,13 @@ discard block |
||
1351 | 1374 | } |
1352 | 1375 | } |
1353 | 1376 | |
1354 | - if (!empty($img_arr)) |
|
1355 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
1356 | - else |
|
1357 | - return false; |
|
1377 | + if (!empty($img_arr)) { |
|
1378 | + return (object)$img_arr; |
|
1379 | + } |
|
1380 | + //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
1381 | + else { |
|
1382 | + return false; |
|
1383 | + } |
|
1358 | 1384 | } |
1359 | 1385 | } |
1360 | 1386 | |
@@ -1381,8 +1407,9 @@ discard block |
||
1381 | 1407 | echo $html; |
1382 | 1408 | } elseif (!empty($html)) { |
1383 | 1409 | return $html; |
1384 | - } else |
|
1385 | - return false; |
|
1410 | + } else { |
|
1411 | + return false; |
|
1412 | + } |
|
1386 | 1413 | } |
1387 | 1414 | } |
1388 | 1415 | |
@@ -1410,8 +1437,9 @@ discard block |
||
1410 | 1437 | } |
1411 | 1438 | $not_featured = ''; |
1412 | 1439 | $sub_dir = ''; |
1413 | - if (!$add_featured) |
|
1414 | - $not_featured = " AND is_featured = 0 "; |
|
1440 | + if (!$add_featured) { |
|
1441 | + $not_featured = " AND is_featured = 0 "; |
|
1442 | + } |
|
1415 | 1443 | |
1416 | 1444 | $arrImages = $wpdb->get_results( |
1417 | 1445 | $wpdb->prepare( |
@@ -1432,8 +1460,9 @@ discard block |
||
1432 | 1460 | |
1433 | 1461 | $file_info = pathinfo($attechment->file); |
1434 | 1462 | |
1435 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
1436 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
1463 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
1464 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
1465 | + } |
|
1437 | 1466 | |
1438 | 1467 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
1439 | 1468 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1478,9 +1507,9 @@ discard block |
||
1478 | 1507 | $default_img = ''; |
1479 | 1508 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
1480 | 1509 | $post_type = get_post_type($post_id); |
1481 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
1482 | - $default_img = $default_catimg['src']; |
|
1483 | - elseif ($no_images) { |
|
1510 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
1511 | + $default_img = $default_catimg['src']; |
|
1512 | + } elseif ($no_images) { |
|
1484 | 1513 | $default_img = get_option('geodir_listing_no_img'); |
1485 | 1514 | } |
1486 | 1515 | |
@@ -1515,8 +1544,9 @@ discard block |
||
1515 | 1544 | $return_arr[] = (object)$img_arr; |
1516 | 1545 | |
1517 | 1546 | return $return_arr; |
1518 | - } else |
|
1519 | - return false; |
|
1547 | + } else { |
|
1548 | + return false; |
|
1549 | + } |
|
1520 | 1550 | } |
1521 | 1551 | } |
1522 | 1552 | } |
@@ -1577,8 +1607,9 @@ discard block |
||
1577 | 1607 | $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
1578 | 1608 | } else if ($image->width < ($max_size->h)) { |
1579 | 1609 | $width_per = round((($image->width / $max_size->w) * 100), 2); |
1580 | - } else |
|
1581 | - $width_per = 100; |
|
1610 | + } else { |
|
1611 | + $width_per = 100; |
|
1612 | + } |
|
1582 | 1613 | } |
1583 | 1614 | |
1584 | 1615 | if (is_admin() && !isset($_REQUEST['geodir_ajax'])){ |
@@ -1586,7 +1617,7 @@ discard block |
||
1586 | 1617 | } else { |
1587 | 1618 | if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){ |
1588 | 1619 | $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
1589 | - }else{ |
|
1620 | + } else{ |
|
1590 | 1621 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
1591 | 1622 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>'; |
1592 | 1623 | $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>'; |
@@ -1601,8 +1632,9 @@ discard block |
||
1601 | 1632 | echo $html; |
1602 | 1633 | } elseif (!empty($html)) { |
1603 | 1634 | return $html; |
1604 | - } else |
|
1605 | - return false; |
|
1635 | + } else { |
|
1636 | + return false; |
|
1637 | + } |
|
1606 | 1638 | } |
1607 | 1639 | } |
1608 | 1640 | |
@@ -1640,8 +1672,9 @@ discard block |
||
1640 | 1672 | $post_obj = get_post($post_id); |
1641 | 1673 | |
1642 | 1674 | $cat_ids = array('0'); |
1643 | - if (is_array($tt_ids)) |
|
1644 | - $cat_ids = $tt_ids; |
|
1675 | + if (is_array($tt_ids)) { |
|
1676 | + $cat_ids = $tt_ids; |
|
1677 | + } |
|
1645 | 1678 | |
1646 | 1679 | |
1647 | 1680 | if (!empty($cat_ids)) { |
@@ -1698,8 +1731,9 @@ discard block |
||
1698 | 1731 | $json .= '}'; |
1699 | 1732 | |
1700 | 1733 | |
1701 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
1702 | - $post_marker_json = $json; |
|
1734 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) { |
|
1735 | + $post_marker_json = $json; |
|
1736 | + } |
|
1703 | 1737 | |
1704 | 1738 | |
1705 | 1739 | 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)))) { |
@@ -1730,10 +1764,13 @@ discard block |
||
1730 | 1764 | if (!empty($post_term) && is_array($post_term)) { |
1731 | 1765 | $categories = implode(',', $post_term); |
1732 | 1766 | |
1733 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
1767 | + if ($categories != '' && $categories != 0) { |
|
1768 | + $categories = ',' . $categories . ','; |
|
1769 | + } |
|
1734 | 1770 | |
1735 | - if (empty($post_marker_json)) |
|
1736 | - $post_marker_json = isset($json) ? $json : ''; |
|
1771 | + if (empty($post_marker_json)) { |
|
1772 | + $post_marker_json = isset($json) ? $json : ''; |
|
1773 | + } |
|
1737 | 1774 | |
1738 | 1775 | if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) { |
1739 | 1776 | |
@@ -1772,8 +1809,9 @@ discard block |
||
1772 | 1809 | |
1773 | 1810 | } |
1774 | 1811 | |
1775 | - if ($default_category == '') |
|
1776 | - $default_category = $categories[0]; |
|
1812 | + if ($default_category == '') { |
|
1813 | + $default_category = $categories[0]; |
|
1814 | + } |
|
1777 | 1815 | |
1778 | 1816 | geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
1779 | 1817 | |
@@ -1917,7 +1955,7 @@ discard block |
||
1917 | 1955 | } ?>"><img alt="bubble image" style="max-height:50px;" |
1918 | 1956 | src="<?php echo $post_images[0]; ?>"/></a></div> |
1919 | 1957 | <?php |
1920 | - }else{ |
|
1958 | + } else{ |
|
1921 | 1959 | echo '<div class="geodir-bubble_image"></div>'; |
1922 | 1960 | } |
1923 | 1961 | } else { |
@@ -1925,7 +1963,7 @@ discard block |
||
1925 | 1963 | ?> |
1926 | 1964 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
1927 | 1965 | <?php |
1928 | - }else{ |
|
1966 | + } else{ |
|
1929 | 1967 | echo '<div class="geodir-bubble_image"></div>'; |
1930 | 1968 | } |
1931 | 1969 | } |
@@ -2016,10 +2054,11 @@ discard block |
||
2016 | 2054 | */ |
2017 | 2055 | function geodir_new_post_default_status() |
2018 | 2056 | { |
2019 | - if (get_option('geodir_new_post_default_status')) |
|
2020 | - return get_option('geodir_new_post_default_status'); |
|
2021 | - else |
|
2022 | - return 'publish'; |
|
2057 | + if (get_option('geodir_new_post_default_status')) { |
|
2058 | + return get_option('geodir_new_post_default_status'); |
|
2059 | + } else { |
|
2060 | + return 'publish'; |
|
2061 | + } |
|
2023 | 2062 | |
2024 | 2063 | } |
2025 | 2064 | } |
@@ -2170,8 +2209,9 @@ discard block |
||
2170 | 2209 | |
2171 | 2210 | $all_postypes = geodir_get_posttypes(); |
2172 | 2211 | |
2173 | - if (!in_array($post_type, $all_postypes)) |
|
2174 | - return false; |
|
2212 | + if (!in_array($post_type, $all_postypes)) { |
|
2213 | + return false; |
|
2214 | + } |
|
2175 | 2215 | |
2176 | 2216 | $table = $plugin_prefix . $post_type . '_detail'; |
2177 | 2217 | |
@@ -2439,8 +2479,9 @@ discard block |
||
2439 | 2479 | $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart'); |
2440 | 2480 | |
2441 | 2481 | $user_meta_data = ''; |
2442 | - if (isset($current_user->data->ID)) |
|
2443 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
2482 | + if (isset($current_user->data->ID)) { |
|
2483 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
2484 | + } |
|
2444 | 2485 | |
2445 | 2486 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) { |
2446 | 2487 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
@@ -2453,8 +2494,9 @@ discard block |
||
2453 | 2494 | |
2454 | 2495 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') { |
2455 | 2496 | $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
2456 | - } else |
|
2457 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
2497 | + } else { |
|
2498 | + $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
2499 | + } |
|
2458 | 2500 | |
2459 | 2501 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
2460 | 2502 | href="javascript:void(0);" |
@@ -2517,14 +2559,16 @@ discard block |
||
2517 | 2559 | WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where; |
2518 | 2560 | |
2519 | 2561 | $cat_post_count = $wpdb->get_var($count_query); |
2520 | - if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
|
2521 | - $cat_post_count = 0; |
|
2562 | + if (empty($cat_post_count) || is_wp_error($cat_post_count)) { |
|
2563 | + $cat_post_count = 0; |
|
2564 | + } |
|
2522 | 2565 | |
2523 | 2566 | return $cat_post_count; |
2524 | 2567 | |
2525 | - } else |
|
2526 | - |
|
2527 | - return $term->count; |
|
2568 | + } else { |
|
2569 | + |
|
2570 | + return $term->count; |
|
2571 | + } |
|
2528 | 2572 | } |
2529 | 2573 | return false; |
2530 | 2574 | |
@@ -2571,13 +2615,15 @@ discard block |
||
2571 | 2615 | return $length; |
2572 | 2616 | } |
2573 | 2617 | |
2574 | - if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) |
|
2575 | - $length = get_option('geodir_desc_word_limit'); |
|
2576 | - elseif (get_query_var('excerpt_length')) |
|
2577 | - $length = get_query_var('excerpt_length'); |
|
2618 | + if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) { |
|
2619 | + $length = get_option('geodir_desc_word_limit'); |
|
2620 | + } elseif (get_query_var('excerpt_length')) { |
|
2621 | + $length = get_query_var('excerpt_length'); |
|
2622 | + } |
|
2578 | 2623 | |
2579 | - if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) |
|
2580 | - $length = get_option('geodir_author_desc_word_limit'); |
|
2624 | + if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) { |
|
2625 | + $length = get_option('geodir_author_desc_word_limit'); |
|
2626 | + } |
|
2581 | 2627 | |
2582 | 2628 | return $length; |
2583 | 2629 | } |
@@ -2710,10 +2756,11 @@ discard block |
||
2710 | 2756 | function geodir_lisiting_belong_to_user($listing_id, $user_id) |
2711 | 2757 | { |
2712 | 2758 | $listing_author_id = geodir_get_listing_author($listing_id); |
2713 | - if ($listing_author_id == $user_id) |
|
2714 | - return true; |
|
2715 | - else |
|
2716 | - return false; |
|
2759 | + if ($listing_author_id == $user_id) { |
|
2760 | + return true; |
|
2761 | + } else { |
|
2762 | + return false; |
|
2763 | + } |
|
2717 | 2764 | |
2718 | 2765 | } |
2719 | 2766 | |
@@ -2762,10 +2809,11 @@ discard block |
||
2762 | 2809 | $pattern = '/-\d+x\d+\./'; |
2763 | 2810 | preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
2764 | 2811 | |
2765 | - if (empty($matches)) |
|
2766 | - return ''; |
|
2767 | - else |
|
2768 | - return $file; |
|
2812 | + if (empty($matches)) { |
|
2813 | + return ''; |
|
2814 | + } else { |
|
2815 | + return $file; |
|
2816 | + } |
|
2769 | 2817 | |
2770 | 2818 | } |
2771 | 2819 | |
@@ -2850,8 +2898,9 @@ discard block |
||
2850 | 2898 | } else { |
2851 | 2899 | //set_post_thumbnail($post_id,-1); |
2852 | 2900 | |
2853 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
2854 | - wp_delete_attachment($post_thumbnail_id); |
|
2901 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) { |
|
2902 | + wp_delete_attachment($post_thumbnail_id); |
|
2903 | + } |
|
2855 | 2904 | |
2856 | 2905 | } |
2857 | 2906 | } |
@@ -2936,8 +2985,9 @@ discard block |
||
2936 | 2985 | |
2937 | 2986 | global $wpdb; |
2938 | 2987 | |
2939 | - if ($listing_type == '') |
|
2940 | - $listing_type = 'gd_place'; |
|
2988 | + if ($listing_type == '') { |
|
2989 | + $listing_type = 'gd_place'; |
|
2990 | + } |
|
2941 | 2991 | |
2942 | 2992 | $fields_info = array(); |
2943 | 2993 | |
@@ -2960,8 +3010,9 @@ discard block |
||
2960 | 3010 | |
2961 | 3011 | $fields_info[$prefix . 'address'] = $data->field_type; |
2962 | 3012 | |
2963 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
2964 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
3013 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
3014 | + $fields_info[$prefix . 'zip'] = $data->field_type; |
|
3015 | + } |
|
2965 | 3016 | |
2966 | 3017 | } else { |
2967 | 3018 |