@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | global $wpdb; |
| 52 | 52 | $result = 0;// no rows affected |
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 54 | + if (!empty($db) && !empty($column)) { |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr"); |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | return $result; |
| 58 | 59 | } |
@@ -82,10 +83,11 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $default_query = ''; |
| 84 | 85 | |
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query = " and is_default IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query = " and is_default = '0' "; |
|
| 86 | + if ($default == 'default') { |
|
| 87 | + $default_query = " and is_default IN ('1') "; |
|
| 88 | + } elseif ($default == 'custom') { |
|
| 89 | + $default_query = " and is_default = '0' "; |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | if ($fields_location == 'detail') {
|
| 91 | 93 | $default_query = " and show_on_detail='1' "; |
@@ -240,10 +242,12 @@ discard block |
||
| 240 | 242 | } |
| 241 | 243 | |
| 242 | 244 | return $field_id; |
| 243 | - } else |
|
| 244 | - return 0; |
|
| 245 | - } else |
|
| 246 | - return 0; |
|
| 245 | + } else { |
|
| 246 | + return 0; |
|
| 247 | + } |
|
| 248 | + } else { |
|
| 249 | + return 0; |
|
| 250 | + } |
|
| 247 | 251 | } |
| 248 | 252 | } |
| 249 | 253 | |
@@ -349,7 +353,9 @@ discard block |
||
| 349 | 353 | |
| 350 | 354 | |
| 351 | 355 | |
| 352 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 356 | + if ($post_type == '') { |
|
| 357 | + $post_type = 'gd_place'; |
|
| 358 | + } |
|
| 353 | 359 | |
| 354 | 360 | |
| 355 | 361 | $detail_table = $plugin_prefix . $post_type . '_detail'; |
@@ -382,20 +388,23 @@ discard block |
||
| 382 | 388 | } |
| 383 | 389 | |
| 384 | 390 | $option_values = ''; |
| 385 | - if (isset($request_field['option_values'])) |
|
| 386 | - $option_values = $request_field['option_values']; |
|
| 391 | + if (isset($request_field['option_values'])) { |
|
| 392 | + $option_values = $request_field['option_values']; |
|
| 393 | + } |
|
| 387 | 394 | |
| 388 | 395 | $cat_sort = ''; |
| 389 | - if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) |
|
| 390 | - $cat_sort = implode(",", $request_field['cat_sort']);
|
|
| 396 | + if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) { |
|
| 397 | + $cat_sort = implode(",", $request_field['cat_sort']); |
|
| 398 | + } |
|
| 391 | 399 | |
| 392 | 400 | $cat_filter = ''; |
| 393 | - if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) |
|
| 394 | - $cat_filter = implode(",", $request_field['cat_filter']);
|
|
| 401 | + if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) { |
|
| 402 | + $cat_filter = implode(",", $request_field['cat_filter']); |
|
| 403 | + } |
|
| 395 | 404 | |
| 396 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 397 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 398 | - else {
|
|
| 405 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) { |
|
| 406 | + $price_pkg = implode(",", $request_field['show_on_pkg']); |
|
| 407 | + } else {
|
|
| 399 | 408 | $package_info = array(); |
| 400 | 409 | |
| 401 | 410 | $package_info = geodir_post_package_info($package_info, '', $post_type); |
@@ -403,22 +412,29 @@ discard block |
||
| 403 | 412 | } |
| 404 | 413 | |
| 405 | 414 | |
| 406 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 407 | - $extra_fields = $request_field['extra']; |
|
| 415 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) { |
|
| 416 | + $extra_fields = $request_field['extra']; |
|
| 417 | + } |
|
| 408 | 418 | |
| 409 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 410 | - $is_default = $request_field['is_default']; |
|
| 411 | - else |
|
| 412 | - $is_default = '0'; |
|
| 419 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') { |
|
| 420 | + $is_default = $request_field['is_default']; |
|
| 421 | + } else { |
|
| 422 | + $is_default = '0'; |
|
| 423 | + } |
|
| 413 | 424 | |
| 414 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 415 | - $is_admin = $request_field['is_admin']; |
|
| 416 | - else |
|
| 417 | - $is_admin = '0'; |
|
| 425 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') { |
|
| 426 | + $is_admin = $request_field['is_admin']; |
|
| 427 | + } else { |
|
| 428 | + $is_admin = '0'; |
|
| 429 | + } |
|
| 418 | 430 | |
| 419 | 431 | |
| 420 | - if ($is_active == '') $is_active = 1; |
|
| 421 | - if ($is_required == '') $is_required = 0; |
|
| 432 | + if ($is_active == '') { |
|
| 433 | + $is_active = 1; |
|
| 434 | + } |
|
| 435 | + if ($is_required == '') { |
|
| 436 | + $is_required = 0; |
|
| 437 | + } |
|
| 422 | 438 | |
| 423 | 439 | |
| 424 | 440 | if ($sort_order == '') {
|
@@ -687,7 +703,7 @@ discard block |
||
| 687 | 703 | } |
| 688 | 704 | if($op_max){$op_size =$op_max; }
|
| 689 | 705 | } |
| 690 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 706 | + } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 691 | 707 | if(strlen($option_values)){
|
| 692 | 708 | $op_size = strlen($option_values); |
| 693 | 709 | } |
@@ -704,11 +720,13 @@ discard block |
||
| 704 | 720 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 705 | 721 | } |
| 706 | 722 | |
| 707 | - if (isset($request_field['cat_display_type'])) |
|
| 708 | - $extra_fields = $request_field['cat_display_type']; |
|
| 723 | + if (isset($request_field['cat_display_type'])) { |
|
| 724 | + $extra_fields = $request_field['cat_display_type']; |
|
| 725 | + } |
|
| 709 | 726 | |
| 710 | - if (isset($request_field['multi_display_type'])) |
|
| 711 | - $extra_fields = $request_field['multi_display_type']; |
|
| 727 | + if (isset($request_field['multi_display_type'])) { |
|
| 728 | + $extra_fields = $request_field['multi_display_type']; |
|
| 729 | + } |
|
| 712 | 730 | |
| 713 | 731 | |
| 714 | 732 | break; |
@@ -722,8 +740,9 @@ discard block |
||
| 722 | 740 | if($alter_result===false){
|
| 723 | 741 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 724 | 742 | } |
| 725 | - if (isset($request_field['advanced_editor'])) |
|
| 726 | - $extra_fields = $request_field['advanced_editor']; |
|
| 743 | + if (isset($request_field['advanced_editor'])) { |
|
| 744 | + $extra_fields = $request_field['advanced_editor']; |
|
| 745 | + } |
|
| 727 | 746 | |
| 728 | 747 | break; |
| 729 | 748 | |
@@ -817,8 +836,9 @@ discard block |
||
| 817 | 836 | ); |
| 818 | 837 | |
| 819 | 838 | |
| 820 | - if ($cat_sort == '') |
|
| 821 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 839 | + if ($cat_sort == '') { |
|
| 840 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name))); |
|
| 841 | + } |
|
| 822 | 842 | |
| 823 | 843 | |
| 824 | 844 | /** |
@@ -1186,8 +1206,10 @@ discard block |
||
| 1186 | 1206 | } |
| 1187 | 1207 | |
| 1188 | 1208 | return $post_meta_info; |
| 1189 | - else: |
|
| 1190 | - return false; |
|
| 1209 | + else { |
|
| 1210 | + : |
|
| 1211 | + return false; |
|
| 1212 | + } |
|
| 1191 | 1213 | endif; |
| 1192 | 1214 | } |
| 1193 | 1215 | |
@@ -1240,8 +1262,9 @@ discard block |
||
| 1240 | 1262 | if (is_admin()) {
|
| 1241 | 1263 | global $post; |
| 1242 | 1264 | |
| 1243 | - if (isset($_REQUEST['post'])) |
|
| 1244 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1265 | + if (isset($_REQUEST['post'])) { |
|
| 1266 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1267 | + } |
|
| 1245 | 1268 | } |
| 1246 | 1269 | |
| 1247 | 1270 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
@@ -1273,7 +1296,10 @@ discard block |
||
| 1273 | 1296 | $fieldset_field_class = 'gd-fieldset-' . $fieldset_id; |
| 1274 | 1297 | ?> |
| 1275 | 1298 | <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?> |
| 1276 | - <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5> |
|
| 1299 | + <?php if ($admin_desc != '') { |
|
| 1300 | + echo '<small>( ' . $admin_desc . ' )</small>'; |
|
| 1301 | +} |
|
| 1302 | +?></h5> |
|
| 1277 | 1303 | <?php |
| 1278 | 1304 | } else if ($type == 'address') {
|
| 1279 | 1305 | $prefix = $name . '_'; |
@@ -1310,17 +1336,27 @@ discard block |
||
| 1310 | 1336 | } |
| 1311 | 1337 | |
| 1312 | 1338 | $location = geodir_get_default_location(); |
| 1313 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1314 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1315 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1339 | + if (empty($city)) { |
|
| 1340 | + $city = isset($location->city) ? $location->city : ''; |
|
| 1341 | + } |
|
| 1342 | + if (empty($region)) { |
|
| 1343 | + $region = isset($location->region) ? $location->region : ''; |
|
| 1344 | + } |
|
| 1345 | + if (empty($country)) { |
|
| 1346 | + $country = isset($location->country) ? $location->country : ''; |
|
| 1347 | + } |
|
| 1316 | 1348 | |
| 1317 | 1349 | $lat_lng_blank = false; |
| 1318 | 1350 | if (empty($lat) && empty($lng)) {
|
| 1319 | 1351 | $lat_lng_blank = true; |
| 1320 | 1352 | } |
| 1321 | 1353 | |
| 1322 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1323 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1354 | + if (empty($lat)) { |
|
| 1355 | + $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1356 | + } |
|
| 1357 | + if (empty($lng)) { |
|
| 1358 | + $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1359 | + } |
|
| 1324 | 1360 | |
| 1325 | 1361 | /** |
| 1326 | 1362 | * Filter the default latitude. |
@@ -1344,10 +1380,16 @@ discard block |
||
| 1344 | 1380 | ?> |
| 1345 | 1381 | |
| 1346 | 1382 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1347 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1383 | + class="<?php if ($is_required) { |
|
| 1384 | + echo 'required_field'; |
|
| 1385 | +} |
|
| 1386 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1348 | 1387 | <label> |
| 1349 | 1388 | <?php _e($address_title, 'geodirectory'); ?> |
| 1350 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1389 | + <?php if ($is_required) { |
|
| 1390 | + echo '<span>*</span>'; |
|
| 1391 | +} |
|
| 1392 | +?> |
|
| 1351 | 1393 | </label> |
| 1352 | 1394 | <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" |
| 1353 | 1395 | id="<?php echo $prefix . 'address';?>" class="geodir_textfield" |
@@ -1408,10 +1450,16 @@ discard block |
||
| 1408 | 1450 | /* show lat lng */ |
| 1409 | 1451 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
| 1410 | 1452 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1411 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1453 | + class="<?php if ($is_required) { |
|
| 1454 | + echo 'required_field'; |
|
| 1455 | +} |
|
| 1456 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1412 | 1457 | <label> |
| 1413 | 1458 | <?php echo PLACE_ADDRESS_LAT; ?> |
| 1414 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1459 | + <?php if ($is_required) { |
|
| 1460 | + echo '<span>*</span>'; |
|
| 1461 | +} |
|
| 1462 | +?> |
|
| 1415 | 1463 | </label> |
| 1416 | 1464 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>" |
| 1417 | 1465 | id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield" |
@@ -1423,10 +1471,16 @@ discard block |
||
| 1423 | 1471 | </div> |
| 1424 | 1472 | |
| 1425 | 1473 | <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row" |
| 1426 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1474 | + class="<?php if ($is_required) { |
|
| 1475 | + echo 'required_field'; |
|
| 1476 | +} |
|
| 1477 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1427 | 1478 | <label> |
| 1428 | 1479 | <?php echo PLACE_ADDRESS_LNG; ?> |
| 1429 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1480 | + <?php if ($is_required) { |
|
| 1481 | + echo '<span>*</span>'; |
|
| 1482 | +} |
|
| 1483 | +?> |
|
| 1430 | 1484 | </label> |
| 1431 | 1485 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>" |
| 1432 | 1486 | id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield" |
@@ -1481,26 +1535,31 @@ discard block |
||
| 1481 | 1535 | <?php } elseif ($type == 'text') {
|
| 1482 | 1536 | |
| 1483 | 1537 | //number and float validation $validation_pattern |
| 1484 | - if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
|
|
| 1485 | - elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1538 | + if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1486 | 1539 | //print_r($val); |
| 1487 | 1540 | //validation |
| 1488 | 1541 | if(isset($val['validation_pattern']) && $val['validation_pattern']){
|
| 1489 | 1542 | $validation = 'pattern="'.$val['validation_pattern'].'"'; |
| 1490 | - }else{$validation='';}
|
|
| 1543 | + } else{$validation='';}
|
|
| 1491 | 1544 | |
| 1492 | 1545 | // validation message |
| 1493 | 1546 | if(isset($val['validation_msg']) && $val['validation_msg']){
|
| 1494 | 1547 | $validation_msg = 'title="'.$val['validation_msg'].'"'; |
| 1495 | - }else{$validation_msg='';}
|
|
| 1548 | + } else{$validation_msg='';}
|
|
| 1496 | 1549 | ?> |
| 1497 | 1550 | |
| 1498 | 1551 | <div id="<?php echo $name;?>_row" |
| 1499 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1552 | + class="<?php if ($is_required) { |
|
| 1553 | + echo 'required_field'; |
|
| 1554 | +} |
|
| 1555 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1500 | 1556 | <label> |
| 1501 | 1557 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1502 | 1558 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1503 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1559 | + <?php if ($is_required) { |
|
| 1560 | + echo '<span>*</span>'; |
|
| 1561 | +} |
|
| 1562 | +?> |
|
| 1504 | 1563 | </label> |
| 1505 | 1564 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1506 | 1565 | value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> /> |
@@ -1516,11 +1575,17 @@ discard block |
||
| 1516 | 1575 | }?> |
| 1517 | 1576 | |
| 1518 | 1577 | <div id="<?php echo $name;?>_row" |
| 1519 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1578 | + class="<?php if ($is_required) { |
|
| 1579 | + echo 'required_field'; |
|
| 1580 | +} |
|
| 1581 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1520 | 1582 | <label> |
| 1521 | 1583 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1522 | 1584 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1523 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1585 | + <?php if ($is_required) { |
|
| 1586 | + echo '<span>*</span>'; |
|
| 1587 | +} |
|
| 1588 | +?> |
|
| 1524 | 1589 | </label> |
| 1525 | 1590 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1526 | 1591 | value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/> |
@@ -1536,11 +1601,17 @@ discard block |
||
| 1536 | 1601 | } ?> |
| 1537 | 1602 | |
| 1538 | 1603 | <div id="<?php echo $name;?>_row" |
| 1539 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1604 | + class="<?php if ($is_required) { |
|
| 1605 | + echo 'required_field'; |
|
| 1606 | +} |
|
| 1607 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1540 | 1608 | <label> |
| 1541 | 1609 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1542 | 1610 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1543 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1611 | + <?php if ($is_required) { |
|
| 1612 | + echo '<span>*</span>'; |
|
| 1613 | +} |
|
| 1614 | +?> |
|
| 1544 | 1615 | </label> |
| 1545 | 1616 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1546 | 1617 | value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/> |
@@ -1556,11 +1627,17 @@ discard block |
||
| 1556 | 1627 | }?> |
| 1557 | 1628 | |
| 1558 | 1629 | <div id="<?php echo $name;?>_row" |
| 1559 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1630 | + class="<?php if ($is_required) { |
|
| 1631 | + echo 'required_field'; |
|
| 1632 | +} |
|
| 1633 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1560 | 1634 | <label> |
| 1561 | 1635 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1562 | 1636 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1563 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1637 | + <?php if ($is_required) { |
|
| 1638 | + echo '<span>*</span>'; |
|
| 1639 | +} |
|
| 1640 | +?> |
|
| 1564 | 1641 | </label> |
| 1565 | 1642 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1566 | 1643 | value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield" |
@@ -1575,11 +1652,17 @@ discard block |
||
| 1575 | 1652 | |
| 1576 | 1653 | <?php } elseif ($type == 'radio') { ?>
|
| 1577 | 1654 | <div id="<?php echo $name;?>_row" |
| 1578 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1655 | + class="<?php if ($is_required) { |
|
| 1656 | + echo 'required_field'; |
|
| 1657 | +} |
|
| 1658 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1579 | 1659 | <label> |
| 1580 | 1660 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1581 | 1661 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1582 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1662 | + <?php if ($is_required) { |
|
| 1663 | + echo '<span>*</span>'; |
|
| 1664 | +} |
|
| 1665 | +?> |
|
| 1583 | 1666 | </label> |
| 1584 | 1667 | <?php if ($option_values) {
|
| 1585 | 1668 | $option_values = geodir_string_values_to_options($option_values, true); |
@@ -1604,11 +1687,17 @@ discard block |
||
| 1604 | 1687 | <?php } elseif ($type == 'checkbox') { ?>
|
| 1605 | 1688 | |
| 1606 | 1689 | <div id="<?php echo $name;?>_row" |
| 1607 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1690 | + class="<?php if ($is_required) { |
|
| 1691 | + echo 'required_field'; |
|
| 1692 | +} |
|
| 1693 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1608 | 1694 | <label> |
| 1609 | 1695 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1610 | 1696 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1611 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1697 | + <?php if ($is_required) { |
|
| 1698 | + echo '<span>*</span>'; |
|
| 1699 | +} |
|
| 1700 | +?> |
|
| 1612 | 1701 | </label> |
| 1613 | 1702 | <?php if ($value != '1') {
|
| 1614 | 1703 | $value = '0'; |
@@ -1628,11 +1717,17 @@ discard block |
||
| 1628 | 1717 | ?> |
| 1629 | 1718 | |
| 1630 | 1719 | <div id="<?php echo $name;?>_row" |
| 1631 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1720 | + class="<?php if ($is_required) { |
|
| 1721 | + echo 'required_field'; |
|
| 1722 | +} |
|
| 1723 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1632 | 1724 | <label> |
| 1633 | 1725 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1634 | 1726 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1635 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1727 | + <?php if ($is_required) { |
|
| 1728 | + echo '<span>*</span>'; |
|
| 1729 | +} |
|
| 1730 | +?> |
|
| 1636 | 1731 | </label><?php |
| 1637 | 1732 | |
| 1638 | 1733 | |
@@ -1660,11 +1755,17 @@ discard block |
||
| 1660 | 1755 | |
| 1661 | 1756 | <?php } elseif ($type == 'select') { ?>
|
| 1662 | 1757 | <div id="<?php echo $name;?>_row" |
| 1663 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1758 | + class="<?php if ($is_required) { |
|
| 1759 | + echo 'required_field'; |
|
| 1760 | +} |
|
| 1761 | +?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1664 | 1762 | <label> |
| 1665 | 1763 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1666 | 1764 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1667 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1765 | + <?php if ($is_required) { |
|
| 1766 | + echo '<span>*</span>'; |
|
| 1767 | +} |
|
| 1768 | +?> |
|
| 1668 | 1769 | </label> |
| 1669 | 1770 | <?php |
| 1670 | 1771 | $option_values_arr = geodir_string_values_to_options($option_values, true); |
@@ -1703,11 +1804,17 @@ discard block |
||
| 1703 | 1804 | } |
| 1704 | 1805 | ?> |
| 1705 | 1806 | <div id="<?php echo $name; ?>_row" |
| 1706 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1807 | + class="<?php if ($is_required) { |
|
| 1808 | + echo 'required_field'; |
|
| 1809 | +} |
|
| 1810 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1707 | 1811 | <label> |
| 1708 | 1812 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1709 | 1813 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1710 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1814 | + <?php if ($is_required) { |
|
| 1815 | + echo '<span>*</span>'; |
|
| 1816 | +} |
|
| 1817 | +?> |
|
| 1711 | 1818 | </label> |
| 1712 | 1819 | <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/> |
| 1713 | 1820 | <?php if ($multi_display == 'select') { ?>
|
@@ -1777,11 +1884,17 @@ discard block |
||
| 1777 | 1884 | ?> |
| 1778 | 1885 | |
| 1779 | 1886 | <div id="<?php echo $name; ?>_row" |
| 1780 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1887 | + class="<?php if ($is_required) { |
|
| 1888 | + echo 'required_field'; |
|
| 1889 | +} |
|
| 1890 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1781 | 1891 | <label> |
| 1782 | 1892 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1783 | 1893 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1784 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1894 | + <?php if ($is_required) { |
|
| 1895 | + echo '<span>*</span>'; |
|
| 1896 | +} |
|
| 1897 | +?> |
|
| 1785 | 1898 | </label> |
| 1786 | 1899 | |
| 1787 | 1900 | <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
|
@@ -1798,8 +1911,9 @@ discard block |
||
| 1798 | 1911 | </div> |
| 1799 | 1912 | <?php } elseif ($type == 'datepicker') {
|
| 1800 | 1913 | |
| 1801 | - if ($extra_fields['date_format'] == '') |
|
| 1802 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 1914 | + if ($extra_fields['date_format'] == '') { |
|
| 1915 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 1916 | + } |
|
| 1803 | 1917 | |
| 1804 | 1918 | $date_format = $extra_fields['date_format']; |
| 1805 | 1919 | $jquery_date_format = $date_format; |
@@ -1813,7 +1927,7 @@ discard block |
||
| 1813 | 1927 | $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
| 1814 | 1928 | |
| 1815 | 1929 | $date_format = str_replace($search, $replace, $date_format); |
| 1816 | - }else{
|
|
| 1930 | + } else{
|
|
| 1817 | 1931 | $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
| 1818 | 1932 | } |
| 1819 | 1933 | |
@@ -1847,12 +1961,18 @@ discard block |
||
| 1847 | 1961 | |
| 1848 | 1962 | </script> |
| 1849 | 1963 | <div id="<?php echo $name;?>_row" |
| 1850 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1964 | + class="<?php if ($is_required) { |
|
| 1965 | + echo 'required_field'; |
|
| 1966 | +} |
|
| 1967 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1851 | 1968 | <label> |
| 1852 | 1969 | |
| 1853 | 1970 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1854 | 1971 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1855 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1972 | + <?php if ($is_required) { |
|
| 1973 | + echo '<span>*</span>'; |
|
| 1974 | +} |
|
| 1975 | +?> |
|
| 1856 | 1976 | </label> |
| 1857 | 1977 | |
| 1858 | 1978 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -1866,8 +1986,9 @@ discard block |
||
| 1866 | 1986 | |
| 1867 | 1987 | <?php } elseif ($type == 'time') {
|
| 1868 | 1988 | |
| 1869 | - if ($value != '') |
|
| 1870 | - $value = date('H:i', strtotime($value));
|
|
| 1989 | + if ($value != '') { |
|
| 1990 | + $value = date('H:i', strtotime($value)); |
|
| 1991 | + } |
|
| 1871 | 1992 | ?> |
| 1872 | 1993 | <script type="text/javascript"> |
| 1873 | 1994 | jQuery(document).ready(function () {
|
@@ -1880,12 +2001,18 @@ discard block |
||
| 1880 | 2001 | }); |
| 1881 | 2002 | </script> |
| 1882 | 2003 | <div id="<?php echo $name;?>_row" |
| 1883 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2004 | + class="<?php if ($is_required) { |
|
| 2005 | + echo 'required_field'; |
|
| 2006 | +} |
|
| 2007 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1884 | 2008 | <label> |
| 1885 | 2009 | |
| 1886 | 2010 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1887 | 2011 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1888 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 2012 | + <?php if ($is_required) { |
|
| 2013 | + echo '<span>*</span>'; |
|
| 2014 | +} |
|
| 2015 | +?> |
|
| 1889 | 2016 | </label> |
| 1890 | 2017 | <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>" |
| 1891 | 2018 | id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
@@ -1901,11 +2028,17 @@ discard block |
||
| 1901 | 2028 | $value = ''; |
| 1902 | 2029 | } ?> |
| 1903 | 2030 | <div id="<?php echo $name;?>_row" |
| 1904 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2031 | + class="<?php if ($is_required) { |
|
| 2032 | + echo 'required_field'; |
|
| 2033 | +} |
|
| 2034 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1905 | 2035 | <label> |
| 1906 | 2036 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1907 | 2037 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1908 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 2038 | + <?php if ($is_required) { |
|
| 2039 | + echo '<span>*</span>'; |
|
| 2040 | +} |
|
| 2041 | +?> |
|
| 1909 | 2042 | </label> |
| 1910 | 2043 | |
| 1911 | 2044 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
@@ -1939,8 +2072,9 @@ discard block |
||
| 1939 | 2072 | $post_cat = implode(",", $post_cat[$name]);
|
| 1940 | 2073 | |
| 1941 | 2074 | } else {
|
| 1942 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1943 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 2075 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
| 2076 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 2077 | + } |
|
| 1944 | 2078 | } |
| 1945 | 2079 | |
| 1946 | 2080 | |
@@ -1978,21 +2112,24 @@ discard block |
||
| 1978 | 2112 | |
| 1979 | 2113 | $cat_display == ''; |
| 1980 | 2114 | $multiple = ''; |
| 1981 | - if ($cat_display == 'multiselect') |
|
| 1982 | - $multiple = 'multiple="multiple"'; |
|
| 2115 | + if ($cat_display == 'multiselect') { |
|
| 2116 | + $multiple = 'multiple="multiple"'; |
|
| 2117 | + } |
|
| 1983 | 2118 | |
| 1984 | 2119 | echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
|
| 1985 | 2120 | |
| 1986 | 2121 | |
| 1987 | - if ($cat_display == 'select') |
|
| 1988 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 2122 | + if ($cat_display == 'select') { |
|
| 2123 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 2124 | + } |
|
| 1989 | 2125 | |
| 1990 | 2126 | } |
| 1991 | 2127 | |
| 1992 | 2128 | echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
| 1993 | 2129 | |
| 1994 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1995 | - echo '</select>'; |
|
| 2130 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 2131 | + echo '</select>'; |
|
| 2132 | + } |
|
| 1996 | 2133 | |
| 1997 | 2134 | } else {
|
| 1998 | 2135 | |
@@ -2022,18 +2159,23 @@ discard block |
||
| 2022 | 2159 | |
| 2023 | 2160 | $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
| 2024 | 2161 | |
| 2025 | - } else |
|
| 2026 | - $file_value = ''; |
|
| 2162 | + } else { |
|
| 2163 | + $file_value = ''; |
|
| 2164 | + } |
|
| 2027 | 2165 | |
| 2028 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 2029 | - $file_multiple = true; // allow multiple files upload |
|
| 2030 | - else |
|
| 2031 | - $file_multiple = false; |
|
| 2166 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) { |
|
| 2167 | + $file_multiple = true; |
|
| 2168 | + } |
|
| 2169 | + // allow multiple files upload |
|
| 2170 | + else { |
|
| 2171 | + $file_multiple = false; |
|
| 2172 | + } |
|
| 2032 | 2173 | |
| 2033 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 2034 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 2035 | - else |
|
| 2036 | - $file_image_limit = 1; |
|
| 2174 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) { |
|
| 2175 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 2176 | + } else { |
|
| 2177 | + $file_image_limit = 1; |
|
| 2178 | + } |
|
| 2037 | 2179 | |
| 2038 | 2180 | $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
| 2039 | 2181 | |
@@ -2041,8 +2183,9 @@ discard block |
||
| 2041 | 2183 | |
| 2042 | 2184 | if (!empty($file_value)) {
|
| 2043 | 2185 | $curImages = explode(',', $file_value);
|
| 2044 | - if (!empty($curImages)) |
|
| 2045 | - $file_totImg = count($curImages); |
|
| 2186 | + if (!empty($curImages)) { |
|
| 2187 | + $file_totImg = count($curImages); |
|
| 2188 | + } |
|
| 2046 | 2189 | } |
| 2047 | 2190 | |
| 2048 | 2191 | $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
|
@@ -2057,12 +2200,18 @@ discard block |
||
| 2057 | 2200 | ?> |
| 2058 | 2201 | |
| 2059 | 2202 | <div id="<?php echo $name;?>_row" |
| 2060 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2203 | + class="<?php if ($is_required) { |
|
| 2204 | + echo 'required_field'; |
|
| 2205 | +} |
|
| 2206 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2061 | 2207 | |
| 2062 | 2208 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 2063 | 2209 | <label |
| 2064 | 2210 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 2065 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 2211 | + echo $site_title; ?><?php if ($is_required) { |
|
| 2212 | + echo '<span>*</span>'; |
|
| 2213 | + } |
|
| 2214 | + ?></label> |
|
| 2066 | 2215 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 2067 | 2216 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 2068 | 2217 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -2205,9 +2354,10 @@ discard block |
||
| 2205 | 2354 | $field_set_start = 0; |
| 2206 | 2355 | |
| 2207 | 2356 | |
| 2208 | - if ($fields_location == 'detail') |
|
| 2209 | - |
|
| 2210 | - $i = 1; |
|
| 2357 | + if ($fields_location == 'detail') { |
|
| 2358 | + |
|
| 2359 | + $i = 1; |
|
| 2360 | + } |
|
| 2211 | 2361 | foreach ($fields_info as $type) {
|
| 2212 | 2362 | $type = stripslashes_deep($type); // strip slashes |
| 2213 | 2363 | $html = ''; |
@@ -2224,8 +2374,9 @@ discard block |
||
| 2224 | 2374 | $variables_array['post_id'] = $post->ID; |
| 2225 | 2375 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
| 2226 | 2376 | $variables_array['value'] = ''; |
| 2227 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 2228 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 2377 | + if (isset($post->{$type['htmlvar_name']})) { |
|
| 2378 | + $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
| 2379 | + } |
|
| 2229 | 2380 | endif; |
| 2230 | 2381 | |
| 2231 | 2382 | //if($type['field_icon']) |
@@ -2352,8 +2503,9 @@ discard block |
||
| 2352 | 2503 | if ($fields_location == 'detail') {
|
| 2353 | 2504 | |
| 2354 | 2505 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2355 | - if ($i % 2 == 0) |
|
| 2356 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2506 | + if ($i % 2 == 0) { |
|
| 2507 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2508 | + } |
|
| 2357 | 2509 | |
| 2358 | 2510 | $i++; |
| 2359 | 2511 | } |
@@ -2427,8 +2579,9 @@ discard block |
||
| 2427 | 2579 | if ($fields_location == 'detail') {
|
| 2428 | 2580 | |
| 2429 | 2581 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2430 | - if ($i % 2 == 0) |
|
| 2431 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2582 | + if ($i % 2 == 0) { |
|
| 2583 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2584 | + } |
|
| 2432 | 2585 | |
| 2433 | 2586 | $i++; |
| 2434 | 2587 | } |
@@ -2470,8 +2623,9 @@ discard block |
||
| 2470 | 2623 | if ($fields_location == 'detail') {
|
| 2471 | 2624 | |
| 2472 | 2625 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2473 | - if ($i % 2 == 0) |
|
| 2474 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2626 | + if ($i % 2 == 0) { |
|
| 2627 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2628 | + } |
|
| 2475 | 2629 | |
| 2476 | 2630 | $i++; |
| 2477 | 2631 | } |
@@ -2491,9 +2645,10 @@ discard block |
||
| 2491 | 2645 | if ($post->{$type['htmlvar_name']}):
|
| 2492 | 2646 | |
| 2493 | 2647 | $value = ''; |
| 2494 | - if ($post->{$type['htmlvar_name']} != '')
|
|
| 2495 | - //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
|
|
| 2496 | - $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
|
|
| 2648 | + if ($post->{$type['htmlvar_name']} != '') { |
|
| 2649 | + //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
|
|
| 2650 | + $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']})); |
|
| 2651 | + } |
|
| 2497 | 2652 | |
| 2498 | 2653 | if (strpos($field_icon, 'http') !== false) {
|
| 2499 | 2654 | $field_icon_af = ''; |
@@ -2508,8 +2663,9 @@ discard block |
||
| 2508 | 2663 | if ($fields_location == 'detail') {
|
| 2509 | 2664 | |
| 2510 | 2665 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2511 | - if ($i % 2 == 0) |
|
| 2512 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2666 | + if ($i % 2 == 0) { |
|
| 2667 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2668 | + } |
|
| 2513 | 2669 | |
| 2514 | 2670 | $i++; |
| 2515 | 2671 | } |
@@ -2541,13 +2697,13 @@ discard block |
||
| 2541 | 2697 | $date_format = str_replace($search, $replace, $date_format); |
| 2542 | 2698 | |
| 2543 | 2699 | $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
|
| 2544 | - }else{
|
|
| 2700 | + } else{
|
|
| 2545 | 2701 | $post_htmlvar_value = $post->{$type['htmlvar_name']};
|
| 2546 | 2702 | } |
| 2547 | 2703 | |
| 2548 | 2704 | if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
|
| 2549 | 2705 | $value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
| 2550 | - }else{
|
|
| 2706 | + } else{
|
|
| 2551 | 2707 | continue; |
| 2552 | 2708 | } |
| 2553 | 2709 | |
@@ -2564,8 +2720,9 @@ discard block |
||
| 2564 | 2720 | if ($fields_location == 'detail') {
|
| 2565 | 2721 | |
| 2566 | 2722 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2567 | - if ($i % 2 == 0) |
|
| 2568 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2723 | + if ($i % 2 == 0) { |
|
| 2724 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2725 | + } |
|
| 2569 | 2726 | |
| 2570 | 2727 | $i++; |
| 2571 | 2728 | } |
@@ -2597,8 +2754,9 @@ discard block |
||
| 2597 | 2754 | if ($fields_location == 'detail') {
|
| 2598 | 2755 | |
| 2599 | 2756 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2600 | - if ($i % 2 == 0) |
|
| 2601 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2757 | + if ($i % 2 == 0) { |
|
| 2758 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2759 | + } |
|
| 2602 | 2760 | |
| 2603 | 2761 | $i++; |
| 2604 | 2762 | } |
@@ -2622,8 +2780,9 @@ discard block |
||
| 2622 | 2780 | if ($fields_location == 'detail') {
|
| 2623 | 2781 | |
| 2624 | 2782 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2625 | - if ($i % 2 == 0) |
|
| 2626 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2783 | + if ($i % 2 == 0) { |
|
| 2784 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2785 | + } |
|
| 2627 | 2786 | |
| 2628 | 2787 | $i++; |
| 2629 | 2788 | } |
@@ -2674,8 +2833,9 @@ discard block |
||
| 2674 | 2833 | if ($fields_location == 'detail') {
|
| 2675 | 2834 | |
| 2676 | 2835 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2677 | - if ($i % 2 == 0) |
|
| 2678 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2836 | + if ($i % 2 == 0) { |
|
| 2837 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2838 | + } |
|
| 2679 | 2839 | |
| 2680 | 2840 | $i++; |
| 2681 | 2841 | } |
@@ -2695,8 +2855,10 @@ discard block |
||
| 2695 | 2855 | |
| 2696 | 2856 | if ($post->{$type['htmlvar_name']} == '1'):
|
| 2697 | 2857 | $html_val = __('Yes', 'geodirectory');
|
| 2698 | - else: |
|
| 2699 | - $html_val = __('No', 'geodirectory');
|
|
| 2858 | + else { |
|
| 2859 | + : |
|
| 2860 | + $html_val = __('No', 'geodirectory'); |
|
| 2861 | + } |
|
| 2700 | 2862 | endif; |
| 2701 | 2863 | |
| 2702 | 2864 | if (strpos($field_icon, 'http') !== false) {
|
@@ -2712,8 +2874,9 @@ discard block |
||
| 2712 | 2874 | if ($fields_location == 'detail') {
|
| 2713 | 2875 | |
| 2714 | 2876 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2715 | - if ($i % 2 == 0) |
|
| 2716 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2877 | + if ($i % 2 == 0) { |
|
| 2878 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2879 | + } |
|
| 2717 | 2880 | |
| 2718 | 2881 | $i++; |
| 2719 | 2882 | } |
@@ -2757,8 +2920,9 @@ discard block |
||
| 2757 | 2920 | if ($fields_location == 'detail') {
|
| 2758 | 2921 | |
| 2759 | 2922 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2760 | - if ($i % 2 == 0) |
|
| 2761 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2923 | + if ($i % 2 == 0) { |
|
| 2924 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2925 | + } |
|
| 2762 | 2926 | |
| 2763 | 2927 | $i++; |
| 2764 | 2928 | } |
@@ -2809,8 +2973,9 @@ discard block |
||
| 2809 | 2973 | if ($fields_location == 'detail') {
|
| 2810 | 2974 | |
| 2811 | 2975 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2812 | - if ($i % 2 == 0) |
|
| 2813 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2976 | + if ($i % 2 == 0) { |
|
| 2977 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2978 | + } |
|
| 2814 | 2979 | |
| 2815 | 2980 | $i++; |
| 2816 | 2981 | } |
@@ -2865,8 +3030,9 @@ discard block |
||
| 2865 | 3030 | if ($fields_location == 'detail') {
|
| 2866 | 3031 | |
| 2867 | 3032 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2868 | - if ($i % 2 == 0) |
|
| 2869 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3033 | + if ($i % 2 == 0) { |
|
| 3034 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3035 | + } |
|
| 2870 | 3036 | |
| 2871 | 3037 | $i++; |
| 2872 | 3038 | } |
@@ -2911,8 +3077,9 @@ discard block |
||
| 2911 | 3077 | if ($fields_location == 'detail') {
|
| 2912 | 3078 | |
| 2913 | 3079 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2914 | - if ($i % 2 == 0) |
|
| 2915 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3080 | + if ($i % 2 == 0) { |
|
| 3081 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3082 | + } |
|
| 2916 | 3083 | |
| 2917 | 3084 | $i++; |
| 2918 | 3085 | } |
@@ -2932,7 +3099,7 @@ discard block |
||
| 2932 | 3099 | */ |
| 2933 | 3100 | $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
|
| 2934 | 3101 | $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
|
| 2935 | - }else{
|
|
| 3102 | + } else{
|
|
| 2936 | 3103 | $html .= $email; |
| 2937 | 3104 | } |
| 2938 | 3105 | $html .= '</span></div>'; |
@@ -3010,8 +3177,9 @@ discard block |
||
| 3010 | 3177 | if ($fields_location == 'detail') {
|
| 3011 | 3178 | |
| 3012 | 3179 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 3013 | - if ($i % 2 == 0) |
|
| 3014 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3180 | + if ($i % 2 == 0) { |
|
| 3181 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3182 | + } |
|
| 3015 | 3183 | |
| 3016 | 3184 | $i++; |
| 3017 | 3185 | } |
@@ -3045,8 +3213,9 @@ discard block |
||
| 3045 | 3213 | if ($fields_location == 'detail') {
|
| 3046 | 3214 | |
| 3047 | 3215 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 3048 | - if ($i % 2 == 0) |
|
| 3049 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3216 | + if ($i % 2 == 0) { |
|
| 3217 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3218 | + } |
|
| 3050 | 3219 | |
| 3051 | 3220 | $i++; |
| 3052 | 3221 | } |
@@ -3074,8 +3243,9 @@ discard block |
||
| 3074 | 3243 | if ($fields_location == 'detail') {
|
| 3075 | 3244 | |
| 3076 | 3245 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 3077 | - if ($i % 2 == 0) |
|
| 3078 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3246 | + if ($i % 2 == 0) { |
|
| 3247 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3248 | + } |
|
| 3079 | 3249 | |
| 3080 | 3250 | $i++; |
| 3081 | 3251 | } |
@@ -3170,7 +3340,9 @@ discard block |
||
| 3170 | 3340 | * @param string $html Custom field unfiltered HTML. |
| 3171 | 3341 | * @param array $variables_array Custom field variables array. |
| 3172 | 3342 | */ |
| 3173 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 3343 | + if ($html) { |
|
| 3344 | + echo apply_filters("geodir_show_{$html_var}", $html, $variables_array); |
|
| 3345 | + } |
|
| 3174 | 3346 | |
| 3175 | 3347 | /** |
| 3176 | 3348 | * Called after a custom fields is output on the frontend. |
@@ -3204,10 +3376,11 @@ discard block |
||
| 3204 | 3376 | */ |
| 3205 | 3377 | function geodir_default_date_format() |
| 3206 | 3378 | {
|
| 3207 | - if ($format = get_option('date_format'))
|
|
| 3208 | - return $format; |
|
| 3209 | - else |
|
| 3210 | - return 'dd-mm-yy'; |
|
| 3379 | + if ($format = get_option('date_format')) { |
|
| 3380 | + return $format; |
|
| 3381 | + } else { |
|
| 3382 | + return 'dd-mm-yy'; |
|
| 3383 | + } |
|
| 3211 | 3384 | } |
| 3212 | 3385 | } |
| 3213 | 3386 | |
@@ -3314,11 +3487,13 @@ discard block |
||
| 3314 | 3487 | // Set an array containing a list of acceptable formats |
| 3315 | 3488 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 3316 | 3489 | |
| 3317 | - if (!function_exists('wp_handle_upload'))
|
|
| 3318 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3490 | + if (!function_exists('wp_handle_upload')) { |
|
| 3491 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3492 | + } |
|
| 3319 | 3493 | |
| 3320 | - if (!is_dir($geodir_uploadpath)) |
|
| 3321 | - mkdir($geodir_uploadpath); |
|
| 3494 | + if (!is_dir($geodir_uploadpath)) { |
|
| 3495 | + mkdir($geodir_uploadpath); |
|
| 3496 | + } |
|
| 3322 | 3497 | |
| 3323 | 3498 | $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
| 3324 | 3499 | $explode_sub_dir = explode("/", $sub_dir);
|
@@ -3331,16 +3506,19 @@ discard block |
||
| 3331 | 3506 | } |
| 3332 | 3507 | |
| 3333 | 3508 | $uploaded_file = ''; |
| 3334 | - if (file_exists($img_path)) |
|
| 3335 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3509 | + if (file_exists($img_path)) { |
|
| 3510 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3511 | + } |
|
| 3336 | 3512 | |
| 3337 | 3513 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 3338 | - if (file_exists($img_path)) |
|
| 3339 | - unlink($img_path); |
|
| 3514 | + if (file_exists($img_path)) { |
|
| 3515 | + unlink($img_path); |
|
| 3516 | + } |
|
| 3340 | 3517 | } |
| 3341 | 3518 | |
| 3342 | - if (!empty($uploaded_file)) |
|
| 3343 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3519 | + if (!empty($uploaded_file)) { |
|
| 3520 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3521 | + } |
|
| 3344 | 3522 | |
| 3345 | 3523 | } else {
|
| 3346 | 3524 | $file_urls = $post_image[$m]; |
@@ -3361,8 +3539,9 @@ discard block |
||
| 3361 | 3539 | |
| 3362 | 3540 | geodir_save_post_meta($post_id, $field_id, $file_urls); |
| 3363 | 3541 | |
| 3364 | - if (!empty($invalid_files)) |
|
| 3365 | - geodir_remove_attachments($invalid_files); |
|
| 3542 | + if (!empty($invalid_files)) { |
|
| 3543 | + geodir_remove_attachments($invalid_files); |
|
| 3544 | + } |
|
| 3366 | 3545 | |
| 3367 | 3546 | } |
| 3368 | 3547 | } |
@@ -3588,8 +3767,9 @@ discard block |
||
| 3588 | 3767 | |
| 3589 | 3768 | $all_postypes = geodir_get_posttypes(); |
| 3590 | 3769 | |
| 3591 | - if (!in_array($post_type, $all_postypes)) |
|
| 3592 | - return false; |
|
| 3770 | + if (!in_array($post_type, $all_postypes)) { |
|
| 3771 | + return false; |
|
| 3772 | + } |
|
| 3593 | 3773 | |
| 3594 | 3774 | $fields = array(); |
| 3595 | 3775 | |
@@ -3677,8 +3857,10 @@ discard block |
||
| 3677 | 3857 | } |
| 3678 | 3858 | |
| 3679 | 3859 | return $field_ids; |
| 3680 | - else: |
|
| 3681 | - return false; |
|
| 3860 | + else { |
|
| 3861 | + : |
|
| 3862 | + return false; |
|
| 3863 | + } |
|
| 3682 | 3864 | endif; |
| 3683 | 3865 | } |
| 3684 | 3866 | |
@@ -3851,8 +4033,9 @@ discard block |
||
| 3851 | 4033 | |
| 3852 | 4034 | return $field_id; |
| 3853 | 4035 | |
| 3854 | - } else |
|
| 3855 | - return 0; |
|
| 4036 | + } else { |
|
| 4037 | + return 0; |
|
| 4038 | + } |
|
| 3856 | 4039 | |
| 3857 | 4040 | } |
| 3858 | 4041 | } |
@@ -3894,8 +4077,9 @@ discard block |
||
| 3894 | 4077 | $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
| 3895 | 4078 | |
| 3896 | 4079 | $site_title = ''; |
| 3897 | - if ($site_title == '') |
|
| 3898 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 4080 | + if ($site_title == '') { |
|
| 4081 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 4082 | + } |
|
| 3899 | 4083 | |
| 3900 | 4084 | if ($site_title == '') {
|
| 3901 | 4085 | $fields = geodir_get_custom_sort_options($post_type); |
@@ -3909,8 +4093,9 @@ discard block |
||
| 3909 | 4093 | } |
| 3910 | 4094 | } |
| 3911 | 4095 | |
| 3912 | - if ($htmlvar_name == '') |
|
| 3913 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 4096 | + if ($htmlvar_name == '') { |
|
| 4097 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 4098 | + } |
|
| 3914 | 4099 | |
| 3915 | 4100 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 3916 | 4101 | |
@@ -19,16 +19,18 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | if (!isset($field_info->post_type)) {
|
| 21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 22 | -} else |
|
| 23 | - $post_type = $field_info->post_type; |
|
| 22 | +} else { |
|
| 23 | + $post_type = $field_info->post_type; |
|
| 24 | +} |
|
| 24 | 25 | |
| 25 | 26 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
| 26 | 27 | |
| 27 | 28 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 28 | 29 | |
| 29 | 30 | $field_admin_title = ''; |
| 30 | -if (isset($field_info->admin_title)) |
|
| 31 | - $field_admin_title = $field_info->admin_title; |
|
| 31 | +if (isset($field_info->admin_title)) { |
|
| 32 | + $field_admin_title = $field_info->admin_title; |
|
| 33 | +} |
|
| 32 | 34 | |
| 33 | 35 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
| 34 | 36 | |
@@ -52,8 +54,11 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | <?php if ($default): ?> |
| 54 | 56 | <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
|
| 55 | - <?php else: ?> |
|
| 56 | - <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 57 | + <?php else { |
|
| 58 | + : ?> |
|
| 59 | + <div title="<?php _e('Click to remove field', 'geodirectory'); |
|
| 60 | +} |
|
| 61 | +?>" |
|
| 57 | 62 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
|
| 58 | 63 | class="handlediv close"></div> |
| 59 | 64 | <?php endif; |
@@ -255,11 +260,13 @@ discard block |
||
| 255 | 260 | |
| 256 | 261 | <?php |
| 257 | 262 | $selected = ''; |
| 258 | - if (isset($field_info->extra_fields)) |
|
| 259 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 263 | + if (isset($field_info->extra_fields)) { |
|
| 264 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 265 | + } |
|
| 260 | 266 | |
| 261 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 262 | - $selected = 'checked="checked"'; |
|
| 267 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) { |
|
| 268 | + $selected = 'checked="checked"'; |
|
| 269 | + } |
|
| 263 | 270 | ?> |
| 264 | 271 | |
| 265 | 272 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
@@ -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); |
@@ -399,7 +401,7 @@ discard block |
||
| 399 | 401 | |
| 400 | 402 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
| 401 | 403 | |
| 402 | - }else{
|
|
| 404 | + } else{
|
|
| 403 | 405 | $post_htmlvar_value = $request_info[$name]; |
| 404 | 406 | } |
| 405 | 407 | |
@@ -439,15 +441,17 @@ discard block |
||
| 439 | 441 | |
| 440 | 442 | foreach ($request_info['post_category'] as $taxonomy => $cat) {
|
| 441 | 443 | |
| 442 | - if ($dummy) |
|
| 443 | - $post_category = $cat; |
|
| 444 | - else {
|
|
| 444 | + if ($dummy) { |
|
| 445 | + $post_category = $cat; |
|
| 446 | + } else {
|
|
| 445 | 447 | |
| 446 | - if (!is_array($cat) && strstr($cat, ',')) |
|
| 447 | - $cat = explode(',', $cat);
|
|
| 448 | + if (!is_array($cat) && strstr($cat, ',')) { |
|
| 449 | + $cat = explode(',', $cat); |
|
| 450 | + } |
|
| 448 | 451 | |
| 449 | - if (!empty($cat) && is_array($cat)) |
|
| 450 | - $post_category = array_map('intval', $cat);
|
|
| 452 | + if (!empty($cat) && is_array($cat)) { |
|
| 453 | + $post_category = array_map('intval', $cat); |
|
| 454 | + } |
|
| 451 | 455 | } |
| 452 | 456 | |
| 453 | 457 | wp_set_object_terms($last_post_id, $post_category, $taxonomy); |
@@ -465,11 +469,13 @@ discard block |
||
| 465 | 469 | if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
|
| 466 | 470 | $post_tags = explode(",", $request_info['post_tags']);
|
| 467 | 471 | } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
|
| 468 | - if ($dummy) |
|
| 469 | - $post_tags = $request_info['post_tags']; |
|
| 472 | + if ($dummy) { |
|
| 473 | + $post_tags = $request_info['post_tags']; |
|
| 474 | + } |
|
| 470 | 475 | } else {
|
| 471 | - if ($dummy) |
|
| 472 | - $post_tags = array($request_info['post_title']); |
|
| 476 | + if ($dummy) { |
|
| 477 | + $post_tags = array($request_info['post_title']); |
|
| 478 | + } |
|
| 473 | 479 | } |
| 474 | 480 | |
| 475 | 481 | if (is_array($post_tags)) {
|
@@ -556,15 +562,17 @@ discard block |
||
| 556 | 562 | |
| 557 | 563 | global $wpdb, $plugin_prefix, $post, $post_info; |
| 558 | 564 | |
| 559 | - if ($post_id == '' && !empty($post)) |
|
| 560 | - $post_id = $post->ID; |
|
| 565 | + if ($post_id == '' && !empty($post)) { |
|
| 566 | + $post_id = $post->ID; |
|
| 567 | + } |
|
| 561 | 568 | |
| 562 | 569 | $post_type = get_post_type($post_id); |
| 563 | 570 | |
| 564 | 571 | $all_postypes = geodir_get_posttypes(); |
| 565 | 572 | |
| 566 | - if (!in_array($post_type, $all_postypes)) |
|
| 567 | - return false; |
|
| 573 | + if (!in_array($post_type, $all_postypes)) { |
|
| 574 | + return false; |
|
| 575 | + } |
|
| 568 | 576 | |
| 569 | 577 | $table = $plugin_prefix . $post_type . '_detail'; |
| 570 | 578 | |
@@ -714,8 +722,9 @@ discard block |
||
| 714 | 722 | do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
|
| 715 | 723 | |
| 716 | 724 | return true; |
| 717 | - } else |
|
| 718 | - return false; |
|
| 725 | + } else { |
|
| 726 | + return false; |
|
| 727 | + } |
|
| 719 | 728 | |
| 720 | 729 | } |
| 721 | 730 | } |
@@ -769,8 +778,9 @@ discard block |
||
| 769 | 778 | } |
| 770 | 779 | |
| 771 | 780 | |
| 772 | - } else |
|
| 773 | - return false; |
|
| 781 | + } else { |
|
| 782 | + return false; |
|
| 783 | + } |
|
| 774 | 784 | } |
| 775 | 785 | } |
| 776 | 786 | |
@@ -801,8 +811,9 @@ discard block |
||
| 801 | 811 | $post_meta_set_query = ''; |
| 802 | 812 | |
| 803 | 813 | foreach ($postmeta as $mkey) {
|
| 804 | - if ($mval != '') |
|
| 805 | - $post_meta_set_query .= $mkey . " = '', "; |
|
| 814 | + if ($mval != '') { |
|
| 815 | + $post_meta_set_query .= $mkey . " = '', "; |
|
| 816 | + } |
|
| 806 | 817 | } |
| 807 | 818 | |
| 808 | 819 | $post_meta_set_query = trim($post_meta_set_query, ", "); |
@@ -832,8 +843,9 @@ discard block |
||
| 832 | 843 | return true; |
| 833 | 844 | } |
| 834 | 845 | |
| 835 | - } else |
|
| 836 | - return false; |
|
| 846 | + } else { |
|
| 847 | + return false; |
|
| 848 | + } |
|
| 837 | 849 | } |
| 838 | 850 | } |
| 839 | 851 | |
@@ -863,8 +875,9 @@ discard block |
||
| 863 | 875 | |
| 864 | 876 | $post_type = get_post_type($post_id); |
| 865 | 877 | |
| 866 | - if (!in_array($post_type, $all_postypes)) |
|
| 867 | - return false; |
|
| 878 | + if (!in_array($post_type, $all_postypes)) { |
|
| 879 | + return false; |
|
| 880 | + } |
|
| 868 | 881 | |
| 869 | 882 | $table = $plugin_prefix . $post_type . '_detail'; |
| 870 | 883 | |
@@ -873,8 +886,9 @@ discard block |
||
| 873 | 886 | |
| 874 | 887 | if ($meta_value && $meta_value !== '') {
|
| 875 | 888 | return maybe_serialize($meta_value); |
| 876 | - } else |
|
| 877 | - return $meta_value; |
|
| 889 | + } else { |
|
| 890 | + return $meta_value; |
|
| 891 | + } |
|
| 878 | 892 | } else {
|
| 879 | 893 | return false; |
| 880 | 894 | } |
@@ -1008,7 +1022,7 @@ discard block |
||
| 1008 | 1022 | if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
| 1009 | 1023 | $new_name = basename($uploaded['file']); |
| 1010 | 1024 | $uploaded_file = $uploaded; |
| 1011 | - }else{
|
|
| 1025 | + } else{
|
|
| 1012 | 1026 | print_r($uploaded);exit; |
| 1013 | 1027 | } |
| 1014 | 1028 | $external_img = false; |
@@ -1033,8 +1047,9 @@ discard block |
||
| 1033 | 1047 | $file_path = $curr_img_dir . '/' . $filename; |
| 1034 | 1048 | } |
| 1035 | 1049 | |
| 1036 | - if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
|
| 1037 | - unlink($img_path); |
|
| 1050 | + if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) { |
|
| 1051 | + unlink($img_path); |
|
| 1052 | + } |
|
| 1038 | 1053 | } |
| 1039 | 1054 | |
| 1040 | 1055 | if (!empty($uploaded_file)) {
|
@@ -1063,8 +1078,9 @@ discard block |
||
| 1063 | 1078 | $attachment_set = ''; |
| 1064 | 1079 | |
| 1065 | 1080 | foreach ($attachment as $key => $val) {
|
| 1066 | - if ($val != '') |
|
| 1067 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1081 | + if ($val != '') { |
|
| 1082 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1083 | + } |
|
| 1068 | 1084 | } |
| 1069 | 1085 | |
| 1070 | 1086 | $attachment_set = trim($attachment_set, ", "); |
@@ -1089,8 +1105,9 @@ discard block |
||
| 1089 | 1105 | ) |
| 1090 | 1106 | ); |
| 1091 | 1107 | |
| 1092 | - if ($menu_order == 1) |
|
| 1093 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1108 | + if ($menu_order == 1) { |
|
| 1109 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id))); |
|
| 1110 | + } |
|
| 1094 | 1111 | |
| 1095 | 1112 | } |
| 1096 | 1113 | |
@@ -1131,8 +1148,9 @@ discard block |
||
| 1131 | 1148 | |
| 1132 | 1149 | $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
| 1133 | 1150 | |
| 1134 | - if (!empty($invalid_files)) |
|
| 1135 | - geodir_remove_attachments($invalid_files); |
|
| 1151 | + if (!empty($invalid_files)) { |
|
| 1152 | + geodir_remove_attachments($invalid_files); |
|
| 1153 | + } |
|
| 1136 | 1154 | } |
| 1137 | 1155 | |
| 1138 | 1156 | } |
@@ -1185,16 +1203,19 @@ discard block |
||
| 1185 | 1203 | function geodir_delete_directory($dirname) |
| 1186 | 1204 | {
|
| 1187 | 1205 | $dir_handle = ''; |
| 1188 | - if (is_dir($dirname)) |
|
| 1189 | - $dir_handle = opendir($dirname); |
|
| 1190 | - if (!$dir_handle) |
|
| 1191 | - return false; |
|
| 1206 | + if (is_dir($dirname)) { |
|
| 1207 | + $dir_handle = opendir($dirname); |
|
| 1208 | + } |
|
| 1209 | + if (!$dir_handle) { |
|
| 1210 | + return false; |
|
| 1211 | + } |
|
| 1192 | 1212 | while ($file = readdir($dir_handle)) {
|
| 1193 | 1213 | if ($file != "." && $file != "..") {
|
| 1194 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1195 | - unlink($dirname . "/" . $file); |
|
| 1196 | - else |
|
| 1197 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1214 | + if (!is_dir($dirname . "/" . $file)) { |
|
| 1215 | + unlink($dirname . "/" . $file); |
|
| 1216 | + } else { |
|
| 1217 | + geodir_delete_directory($dirname . '/' . $file); |
|
| 1218 | + } |
|
| 1198 | 1219 | } |
| 1199 | 1220 | } |
| 1200 | 1221 | closedir($dir_handle); |
@@ -1223,8 +1244,9 @@ discard block |
||
| 1223 | 1244 | foreach ($postcurr_images as $postimg) {
|
| 1224 | 1245 | $image_name_arr = explode('/', $postimg->src);
|
| 1225 | 1246 | $filename = end($image_name_arr); |
| 1226 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1227 | - unlink($uploads_dir . '/' . $filename); |
|
| 1247 | + if (file_exists($uploads_dir . '/' . $filename)) { |
|
| 1248 | + unlink($uploads_dir . '/' . $filename); |
|
| 1249 | + } |
|
| 1228 | 1250 | } |
| 1229 | 1251 | |
| 1230 | 1252 | } // endif |
@@ -1283,8 +1305,9 @@ discard block |
||
| 1283 | 1305 | |
| 1284 | 1306 | $file_info = pathinfo($file); |
| 1285 | 1307 | $sub_dir = ''; |
| 1286 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1287 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1308 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 1309 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1310 | + } |
|
| 1288 | 1311 | |
| 1289 | 1312 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 1290 | 1313 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1328,9 +1351,9 @@ discard block |
||
| 1328 | 1351 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
| 1329 | 1352 | } |
| 1330 | 1353 | |
| 1331 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1332 | - $default_img = $default_catimg['src']; |
|
| 1333 | - elseif ($no_image) {
|
|
| 1354 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
| 1355 | + $default_img = $default_catimg['src']; |
|
| 1356 | + } elseif ($no_image) {
|
|
| 1334 | 1357 | $default_img = get_option('geodir_listing_no_img');
|
| 1335 | 1358 | } |
| 1336 | 1359 | |
@@ -1362,10 +1385,13 @@ discard block |
||
| 1362 | 1385 | } |
| 1363 | 1386 | } |
| 1364 | 1387 | |
| 1365 | - if (!empty($img_arr)) |
|
| 1366 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1367 | - else |
|
| 1368 | - return false; |
|
| 1388 | + if (!empty($img_arr)) { |
|
| 1389 | + return (object)$img_arr; |
|
| 1390 | + } |
|
| 1391 | + //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1392 | + else { |
|
| 1393 | + return false; |
|
| 1394 | + } |
|
| 1369 | 1395 | } |
| 1370 | 1396 | } |
| 1371 | 1397 | |
@@ -1392,8 +1418,9 @@ discard block |
||
| 1392 | 1418 | echo $html; |
| 1393 | 1419 | } elseif (!empty($html)) {
|
| 1394 | 1420 | return $html; |
| 1395 | - } else |
|
| 1396 | - return false; |
|
| 1421 | + } else { |
|
| 1422 | + return false; |
|
| 1423 | + } |
|
| 1397 | 1424 | } |
| 1398 | 1425 | } |
| 1399 | 1426 | |
@@ -1421,8 +1448,9 @@ discard block |
||
| 1421 | 1448 | } |
| 1422 | 1449 | $not_featured = ''; |
| 1423 | 1450 | $sub_dir = ''; |
| 1424 | - if (!$add_featured) |
|
| 1425 | - $not_featured = " AND is_featured = 0 "; |
|
| 1451 | + if (!$add_featured) { |
|
| 1452 | + $not_featured = " AND is_featured = 0 "; |
|
| 1453 | + } |
|
| 1426 | 1454 | |
| 1427 | 1455 | $arrImages = $wpdb->get_results( |
| 1428 | 1456 | $wpdb->prepare( |
@@ -1443,8 +1471,9 @@ discard block |
||
| 1443 | 1471 | |
| 1444 | 1472 | $file_info = pathinfo($attechment->file); |
| 1445 | 1473 | |
| 1446 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1447 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1474 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 1475 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1476 | + } |
|
| 1448 | 1477 | |
| 1449 | 1478 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 1450 | 1479 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1489,9 +1518,9 @@ discard block |
||
| 1489 | 1518 | $default_img = ''; |
| 1490 | 1519 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
| 1491 | 1520 | $post_type = get_post_type($post_id); |
| 1492 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1493 | - $default_img = $default_catimg['src']; |
|
| 1494 | - elseif ($no_images) {
|
|
| 1521 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
| 1522 | + $default_img = $default_catimg['src']; |
|
| 1523 | + } elseif ($no_images) {
|
|
| 1495 | 1524 | $default_img = get_option('geodir_listing_no_img');
|
| 1496 | 1525 | } |
| 1497 | 1526 | |
@@ -1526,8 +1555,9 @@ discard block |
||
| 1526 | 1555 | $return_arr[] = (object)$img_arr; |
| 1527 | 1556 | |
| 1528 | 1557 | return $return_arr; |
| 1529 | - } else |
|
| 1530 | - return false; |
|
| 1558 | + } else { |
|
| 1559 | + return false; |
|
| 1560 | + } |
|
| 1531 | 1561 | } |
| 1532 | 1562 | } |
| 1533 | 1563 | } |
@@ -1588,8 +1618,9 @@ discard block |
||
| 1588 | 1618 | $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
| 1589 | 1619 | } else if ($image->width < ($max_size->h)) {
|
| 1590 | 1620 | $width_per = round((($image->width / $max_size->w) * 100), 2); |
| 1591 | - } else |
|
| 1592 | - $width_per = 100; |
|
| 1621 | + } else { |
|
| 1622 | + $width_per = 100; |
|
| 1623 | + } |
|
| 1593 | 1624 | } |
| 1594 | 1625 | |
| 1595 | 1626 | if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
@@ -1597,7 +1628,7 @@ discard block |
||
| 1597 | 1628 | } else {
|
| 1598 | 1629 | if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
| 1599 | 1630 | $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
| 1600 | - }else{
|
|
| 1631 | + } else{
|
|
| 1601 | 1632 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
| 1602 | 1633 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>'; |
| 1603 | 1634 | $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>'; |
@@ -1612,8 +1643,9 @@ discard block |
||
| 1612 | 1643 | echo $html; |
| 1613 | 1644 | } elseif (!empty($html)) {
|
| 1614 | 1645 | return $html; |
| 1615 | - } else |
|
| 1616 | - return false; |
|
| 1646 | + } else { |
|
| 1647 | + return false; |
|
| 1648 | + } |
|
| 1617 | 1649 | } |
| 1618 | 1650 | } |
| 1619 | 1651 | |
@@ -1651,8 +1683,9 @@ discard block |
||
| 1651 | 1683 | $post_obj = get_post($post_id); |
| 1652 | 1684 | |
| 1653 | 1685 | $cat_ids = array('0');
|
| 1654 | - if (is_array($tt_ids)) |
|
| 1655 | - $cat_ids = $tt_ids; |
|
| 1686 | + if (is_array($tt_ids)) { |
|
| 1687 | + $cat_ids = $tt_ids; |
|
| 1688 | + } |
|
| 1656 | 1689 | |
| 1657 | 1690 | |
| 1658 | 1691 | if (!empty($cat_ids)) {
|
@@ -1709,8 +1742,9 @@ discard block |
||
| 1709 | 1742 | $json .= '}'; |
| 1710 | 1743 | |
| 1711 | 1744 | |
| 1712 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
| 1713 | - $post_marker_json = $json; |
|
| 1745 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) { |
|
| 1746 | + $post_marker_json = $json; |
|
| 1747 | + } |
|
| 1714 | 1748 | |
| 1715 | 1749 | |
| 1716 | 1750 | 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)))) {
|
@@ -1741,10 +1775,13 @@ discard block |
||
| 1741 | 1775 | if (!empty($post_term) && is_array($post_term)) {
|
| 1742 | 1776 | $categories = implode(',', $post_term);
|
| 1743 | 1777 | |
| 1744 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1778 | + if ($categories != '' && $categories != 0) { |
|
| 1779 | + $categories = ',' . $categories . ','; |
|
| 1780 | + } |
|
| 1745 | 1781 | |
| 1746 | - if (empty($post_marker_json)) |
|
| 1747 | - $post_marker_json = isset($json) ? $json : ''; |
|
| 1782 | + if (empty($post_marker_json)) { |
|
| 1783 | + $post_marker_json = isset($json) ? $json : ''; |
|
| 1784 | + } |
|
| 1748 | 1785 | |
| 1749 | 1786 | if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
| 1750 | 1787 | |
@@ -1783,8 +1820,9 @@ discard block |
||
| 1783 | 1820 | |
| 1784 | 1821 | } |
| 1785 | 1822 | |
| 1786 | - if ($default_category == '') |
|
| 1787 | - $default_category = $categories[0]; |
|
| 1823 | + if ($default_category == '') { |
|
| 1824 | + $default_category = $categories[0]; |
|
| 1825 | + } |
|
| 1788 | 1826 | |
| 1789 | 1827 | geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
| 1790 | 1828 | |
@@ -1928,7 +1966,7 @@ discard block |
||
| 1928 | 1966 | } ?>"><img alt="bubble image" style="max-height:50px;" |
| 1929 | 1967 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1930 | 1968 | <?php |
| 1931 | - }else{
|
|
| 1969 | + } else{
|
|
| 1932 | 1970 | echo '<div class="geodir-bubble_image"></div>'; |
| 1933 | 1971 | } |
| 1934 | 1972 | } else {
|
@@ -1936,7 +1974,7 @@ discard block |
||
| 1936 | 1974 | ?> |
| 1937 | 1975 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 1938 | 1976 | <?php |
| 1939 | - }else{
|
|
| 1977 | + } else{
|
|
| 1940 | 1978 | echo '<div class="geodir-bubble_image"></div>'; |
| 1941 | 1979 | } |
| 1942 | 1980 | } |
@@ -2038,10 +2076,11 @@ discard block |
||
| 2038 | 2076 | */ |
| 2039 | 2077 | function geodir_new_post_default_status() |
| 2040 | 2078 | {
|
| 2041 | - if (get_option('geodir_new_post_default_status'))
|
|
| 2042 | - return get_option('geodir_new_post_default_status');
|
|
| 2043 | - else |
|
| 2044 | - return 'publish'; |
|
| 2079 | + if (get_option('geodir_new_post_default_status')) { |
|
| 2080 | + return get_option('geodir_new_post_default_status'); |
|
| 2081 | + } else { |
|
| 2082 | + return 'publish'; |
|
| 2083 | + } |
|
| 2045 | 2084 | |
| 2046 | 2085 | } |
| 2047 | 2086 | } |
@@ -2192,8 +2231,9 @@ discard block |
||
| 2192 | 2231 | |
| 2193 | 2232 | $all_postypes = geodir_get_posttypes(); |
| 2194 | 2233 | |
| 2195 | - if (!in_array($post_type, $all_postypes)) |
|
| 2196 | - return false; |
|
| 2234 | + if (!in_array($post_type, $all_postypes)) { |
|
| 2235 | + return false; |
|
| 2236 | + } |
|
| 2197 | 2237 | |
| 2198 | 2238 | $table = $plugin_prefix . $post_type . '_detail'; |
| 2199 | 2239 | |
@@ -2461,8 +2501,9 @@ discard block |
||
| 2461 | 2501 | $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
|
| 2462 | 2502 | |
| 2463 | 2503 | $user_meta_data = ''; |
| 2464 | - if (isset($current_user->data->ID)) |
|
| 2465 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2504 | + if (isset($current_user->data->ID)) { |
|
| 2505 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2506 | + } |
|
| 2466 | 2507 | |
| 2467 | 2508 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
| 2468 | 2509 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
@@ -2475,8 +2516,9 @@ discard block |
||
| 2475 | 2516 | |
| 2476 | 2517 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
| 2477 | 2518 | $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
| 2478 | - } else |
|
| 2479 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2519 | + } else { |
|
| 2520 | + $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
| 2521 | + } |
|
| 2480 | 2522 | |
| 2481 | 2523 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
| 2482 | 2524 | href="javascript:void(0);" |
@@ -2539,14 +2581,16 @@ discard block |
||
| 2539 | 2581 | WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
| 2540 | 2582 | |
| 2541 | 2583 | $cat_post_count = $wpdb->get_var($count_query); |
| 2542 | - if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
|
| 2543 | - $cat_post_count = 0; |
|
| 2584 | + if (empty($cat_post_count) || is_wp_error($cat_post_count)) { |
|
| 2585 | + $cat_post_count = 0; |
|
| 2586 | + } |
|
| 2544 | 2587 | |
| 2545 | 2588 | return $cat_post_count; |
| 2546 | 2589 | |
| 2547 | - } else |
|
| 2548 | - |
|
| 2549 | - return $term->count; |
|
| 2590 | + } else { |
|
| 2591 | + |
|
| 2592 | + return $term->count; |
|
| 2593 | + } |
|
| 2550 | 2594 | } |
| 2551 | 2595 | return false; |
| 2552 | 2596 | |
@@ -2593,13 +2637,15 @@ discard block |
||
| 2593 | 2637 | return $length; |
| 2594 | 2638 | } |
| 2595 | 2639 | |
| 2596 | - if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
|
|
| 2597 | - $length = get_option('geodir_desc_word_limit');
|
|
| 2598 | - elseif (get_query_var('excerpt_length'))
|
|
| 2599 | - $length = get_query_var('excerpt_length');
|
|
| 2640 | + if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) { |
|
| 2641 | + $length = get_option('geodir_desc_word_limit'); |
|
| 2642 | + } elseif (get_query_var('excerpt_length')) { |
|
| 2643 | + $length = get_query_var('excerpt_length'); |
|
| 2644 | + } |
|
| 2600 | 2645 | |
| 2601 | - if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
|
|
| 2602 | - $length = get_option('geodir_author_desc_word_limit');
|
|
| 2646 | + if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) { |
|
| 2647 | + $length = get_option('geodir_author_desc_word_limit'); |
|
| 2648 | + } |
|
| 2603 | 2649 | |
| 2604 | 2650 | return $length; |
| 2605 | 2651 | } |
@@ -2732,10 +2778,11 @@ discard block |
||
| 2732 | 2778 | function geodir_lisiting_belong_to_user($listing_id, $user_id) |
| 2733 | 2779 | {
|
| 2734 | 2780 | $listing_author_id = geodir_get_listing_author($listing_id); |
| 2735 | - if ($listing_author_id == $user_id) |
|
| 2736 | - return true; |
|
| 2737 | - else |
|
| 2738 | - return false; |
|
| 2781 | + if ($listing_author_id == $user_id) { |
|
| 2782 | + return true; |
|
| 2783 | + } else { |
|
| 2784 | + return false; |
|
| 2785 | + } |
|
| 2739 | 2786 | |
| 2740 | 2787 | } |
| 2741 | 2788 | |
@@ -2784,10 +2831,11 @@ discard block |
||
| 2784 | 2831 | $pattern = '/-\d+x\d+\./'; |
| 2785 | 2832 | preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
| 2786 | 2833 | |
| 2787 | - if (empty($matches)) |
|
| 2788 | - return ''; |
|
| 2789 | - else |
|
| 2790 | - return $file; |
|
| 2834 | + if (empty($matches)) { |
|
| 2835 | + return ''; |
|
| 2836 | + } else { |
|
| 2837 | + return $file; |
|
| 2838 | + } |
|
| 2791 | 2839 | |
| 2792 | 2840 | } |
| 2793 | 2841 | |
@@ -2872,8 +2920,9 @@ discard block |
||
| 2872 | 2920 | } else {
|
| 2873 | 2921 | //set_post_thumbnail($post_id,-1); |
| 2874 | 2922 | |
| 2875 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
| 2876 | - wp_delete_attachment($post_thumbnail_id); |
|
| 2923 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) { |
|
| 2924 | + wp_delete_attachment($post_thumbnail_id); |
|
| 2925 | + } |
|
| 2877 | 2926 | |
| 2878 | 2927 | } |
| 2879 | 2928 | } |
@@ -2958,8 +3007,9 @@ discard block |
||
| 2958 | 3007 | |
| 2959 | 3008 | global $wpdb; |
| 2960 | 3009 | |
| 2961 | - if ($listing_type == '') |
|
| 2962 | - $listing_type = 'gd_place'; |
|
| 3010 | + if ($listing_type == '') { |
|
| 3011 | + $listing_type = 'gd_place'; |
|
| 3012 | + } |
|
| 2963 | 3013 | |
| 2964 | 3014 | $fields_info = array(); |
| 2965 | 3015 | |
@@ -2982,8 +3032,9 @@ discard block |
||
| 2982 | 3032 | |
| 2983 | 3033 | $fields_info[$prefix . 'address'] = $data->field_type; |
| 2984 | 3034 | |
| 2985 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
| 2986 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3035 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 3036 | + $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3037 | + } |
|
| 2987 | 3038 | |
| 2988 | 3039 | } else {
|
| 2989 | 3040 | |
@@ -86,8 +86,9 @@ discard block |
||
| 86 | 86 | add_filter('query_vars', 'geodir_add_location_var');
|
| 87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var');
|
| 88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
|
| 89 | -if (get_option('permalink_structure') != '')
|
|
| 90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
|
|
| 89 | +if (get_option('permalink_structure') != '') { |
|
| 90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
| 91 | +} |
|
| 91 | 92 | |
| 92 | 93 | add_filter('parse_query', 'geodir_modified_query');
|
| 93 | 94 | |
@@ -421,8 +422,9 @@ discard block |
||
| 421 | 422 | */ |
| 422 | 423 | do_action('geodir_after_social_sharing_buttons');
|
| 423 | 424 | $content_html = ob_get_clean(); |
| 424 | - if (trim($content_html) != '') |
|
| 425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 425 | + if (trim($content_html) != '') { |
|
| 426 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 427 | + } |
|
| 426 | 428 | if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
|
| 427 | 429 | /** |
| 428 | 430 | * Filter the geodir_social_sharing_buttons() function content. |
@@ -468,8 +470,9 @@ discard block |
||
| 468 | 470 | */ |
| 469 | 471 | do_action('geodir_after_share_this_button');
|
| 470 | 472 | $content_html = ob_get_clean(); |
| 471 | - if (trim($content_html) != '') |
|
| 472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
| 473 | + if (trim($content_html) != '') { |
|
| 474 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
| 475 | + } |
|
| 473 | 476 | if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
|
| 474 | 477 | /** |
| 475 | 478 | * Filter the geodir_share_this_button() function content. |
@@ -524,8 +527,9 @@ discard block |
||
| 524 | 527 | */ |
| 525 | 528 | do_action('geodir_after_edit_post_link');
|
| 526 | 529 | $content_html = ob_get_clean(); |
| 527 | - if (trim($content_html) != '') |
|
| 528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 530 | + if (trim($content_html) != '') { |
|
| 531 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 532 | + } |
|
| 529 | 533 | if ((int)get_option('geodir_disable_user_links_section') != 1) {
|
| 530 | 534 | /** |
| 531 | 535 | * Filter the geodir_edit_post_link() function content. |
@@ -1098,8 +1102,9 @@ discard block |
||
| 1098 | 1102 | */ |
| 1099 | 1103 | do_action('geodir_after_google_analytics');
|
| 1100 | 1104 | $content_html = ob_get_clean(); |
| 1101 | - if (trim($content_html) != '') |
|
| 1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1105 | + if (trim($content_html) != '') { |
|
| 1106 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1107 | + } |
|
| 1103 | 1108 | if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
|
| 1104 | 1109 | /** |
| 1105 | 1110 | * Filter the geodir_edit_post_link() function content. |
@@ -1236,8 +1241,9 @@ discard block |
||
| 1236 | 1241 | do_action('geodir_after_detail_page_more_info');
|
| 1237 | 1242 | |
| 1238 | 1243 | $content_html = ob_get_clean(); |
| 1239 | - if (trim($content_html) != '') |
|
| 1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1244 | + if (trim($content_html) != '') { |
|
| 1245 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1246 | + } |
|
| 1241 | 1247 | if ((int)get_option('geodir_disable_listing_info_section') != 1) {
|
| 1242 | 1248 | /** |
| 1243 | 1249 | * Filter the output html for function geodir_detail_page_more_info(). |
@@ -1352,8 +1358,9 @@ discard block |
||
| 1352 | 1358 | $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
|
| 1353 | 1359 | |
| 1354 | 1360 | foreach ($arr_alert_msg as $key => $value) {
|
| 1355 | - if (!is_scalar($value)) |
|
| 1356 | - continue; |
|
| 1361 | + if (!is_scalar($value)) { |
|
| 1362 | + continue; |
|
| 1363 | + } |
|
| 1357 | 1364 | $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
| 1358 | 1365 | } |
| 1359 | 1366 | |
@@ -1407,17 +1414,19 @@ discard block |
||
| 1407 | 1414 | global $geodir_sidebars; |
| 1408 | 1415 | global $sidebars_widgets; |
| 1409 | 1416 | |
| 1410 | - if (!is_array($sidebars_widgets)) |
|
| 1411 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1417 | + if (!is_array($sidebars_widgets)) { |
|
| 1418 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1419 | + } |
|
| 1412 | 1420 | $geodir_old_sidebars = array(); |
| 1413 | 1421 | |
| 1414 | 1422 | if (is_array($geodir_sidebars)) {
|
| 1415 | 1423 | foreach ($geodir_sidebars as $val) {
|
| 1416 | 1424 | if (is_array($sidebars_widgets)) {
|
| 1417 | - if (array_key_exists($val, $sidebars_widgets)) |
|
| 1418 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
| 1419 | - else |
|
| 1420 | - $geodir_old_sidebars[$val] = array(); |
|
| 1425 | + if (array_key_exists($val, $sidebars_widgets)) { |
|
| 1426 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
| 1427 | + } else { |
|
| 1428 | + $geodir_old_sidebars[$val] = array(); |
|
| 1429 | + } |
|
| 1421 | 1430 | } |
| 1422 | 1431 | } |
| 1423 | 1432 | } |
@@ -1438,16 +1447,19 @@ discard block |
||
| 1438 | 1447 | {
|
| 1439 | 1448 | global $sidebars_widgets; |
| 1440 | 1449 | |
| 1441 | - if (!is_array($sidebars_widgets)) |
|
| 1442 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1450 | + if (!is_array($sidebars_widgets)) { |
|
| 1451 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1452 | + } |
|
| 1443 | 1453 | |
| 1444 | 1454 | if (is_array($sidebars_widgets)) {
|
| 1445 | 1455 | $geodir_old_sidebars = get_option('geodir_sidebars');
|
| 1446 | 1456 | if (is_array($geodir_old_sidebars)) {
|
| 1447 | 1457 | foreach ($geodir_old_sidebars as $key => $val) {
|
| 1448 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
| 1458 | + if(0 === strpos($key, 'geodir_')) { |
|
| 1459 | + // if gd widget |
|
| 1449 | 1460 | {
|
| 1450 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
| 1461 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
| 1462 | + } |
|
| 1451 | 1463 | } |
| 1452 | 1464 | |
| 1453 | 1465 | |
@@ -1583,20 +1595,25 @@ discard block |
||
| 1583 | 1595 | } |
| 1584 | 1596 | } |
| 1585 | 1597 | |
| 1586 | - if ($tab == 'post_info') |
|
| 1587 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
| 1598 | + if ($tab == 'post_info') { |
|
| 1599 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
| 1600 | + } |
|
| 1588 | 1601 | |
| 1589 | - if ($tab == 'post_images') |
|
| 1590 | - $is_display = (!empty($post_images)) ? true : false; |
|
| 1602 | + if ($tab == 'post_images') { |
|
| 1603 | + $is_display = (!empty($post_images)) ? true : false; |
|
| 1604 | + } |
|
| 1591 | 1605 | |
| 1592 | - if ($tab == 'post_video') |
|
| 1593 | - $is_display = (!empty($video)) ? true : false; |
|
| 1606 | + if ($tab == 'post_video') { |
|
| 1607 | + $is_display = (!empty($video)) ? true : false; |
|
| 1608 | + } |
|
| 1594 | 1609 | |
| 1595 | - if ($tab == 'special_offers') |
|
| 1596 | - $is_display = (!empty($special_offers)) ? true : false; |
|
| 1610 | + if ($tab == 'special_offers') { |
|
| 1611 | + $is_display = (!empty($special_offers)) ? true : false; |
|
| 1612 | + } |
|
| 1597 | 1613 | |
| 1598 | - if ($tab == 'reviews') |
|
| 1599 | - $is_display = (geodir_is_page('detail')) ? true : false;
|
|
| 1614 | + if ($tab == 'reviews') { |
|
| 1615 | + $is_display = (geodir_is_page('detail')) ? true : false; |
|
| 1616 | + } |
|
| 1600 | 1617 | |
| 1601 | 1618 | if ($tab == 'related_listing') {
|
| 1602 | 1619 | $message = __('No listings found which match your selection.', 'geodirectory');
|
@@ -1830,11 +1847,13 @@ discard block |
||
| 1830 | 1847 | $region_slug = $default_location->region_slug; |
| 1831 | 1848 | $city_slug = $default_location->city_slug; |
| 1832 | 1849 | |
| 1833 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
| 1834 | - return $slug_exists = true; |
|
| 1850 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) { |
|
| 1851 | + return $slug_exists = true; |
|
| 1852 | + } |
|
| 1835 | 1853 | |
| 1836 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
|
|
| 1837 | - return $slug_exists = true; |
|
| 1854 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) { |
|
| 1855 | + return $slug_exists = true; |
|
| 1856 | + } |
|
| 1838 | 1857 | |
| 1839 | 1858 | return $slug_exists; |
| 1840 | 1859 | } |
@@ -1876,40 +1895,31 @@ discard block |
||
| 1876 | 1895 | if(geodir_is_page('home')){
|
| 1877 | 1896 | $gd_page = 'home'; |
| 1878 | 1897 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
|
| 1879 | - } |
|
| 1880 | - elseif(geodir_is_page('detail')){
|
|
| 1898 | + } elseif(geodir_is_page('detail')){
|
|
| 1881 | 1899 | $gd_page = 'detail'; |
| 1882 | 1900 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
|
| 1883 | - } |
|
| 1884 | - elseif(geodir_is_page('pt')){
|
|
| 1901 | + } elseif(geodir_is_page('pt')){
|
|
| 1885 | 1902 | $gd_page = 'pt'; |
| 1886 | 1903 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
|
| 1887 | - } |
|
| 1888 | - elseif(geodir_is_page('listing')){
|
|
| 1904 | + } elseif(geodir_is_page('listing')){
|
|
| 1889 | 1905 | $gd_page = 'listing'; |
| 1890 | 1906 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
|
| 1891 | - } |
|
| 1892 | - elseif(geodir_is_page('location')){
|
|
| 1907 | + } elseif(geodir_is_page('location')){
|
|
| 1893 | 1908 | $gd_page = 'location'; |
| 1894 | 1909 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
|
| 1895 | - } |
|
| 1896 | - elseif(geodir_is_page('search')){
|
|
| 1910 | + } elseif(geodir_is_page('search')){
|
|
| 1897 | 1911 | $gd_page = 'search'; |
| 1898 | 1912 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
|
| 1899 | - } |
|
| 1900 | - elseif(geodir_is_page('add-listing')){
|
|
| 1913 | + } elseif(geodir_is_page('add-listing')){
|
|
| 1901 | 1914 | $gd_page = 'add-listing'; |
| 1902 | 1915 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
|
| 1903 | - } |
|
| 1904 | - elseif(geodir_is_page('author')){
|
|
| 1916 | + } elseif(geodir_is_page('author')){
|
|
| 1905 | 1917 | $gd_page = 'author'; |
| 1906 | 1918 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
|
| 1907 | - } |
|
| 1908 | - elseif(geodir_is_page('login')){
|
|
| 1919 | + } elseif(geodir_is_page('login')){
|
|
| 1909 | 1920 | $gd_page = 'login'; |
| 1910 | 1921 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
|
| 1911 | - } |
|
| 1912 | - elseif(geodir_is_page('listing-success')){
|
|
| 1922 | + } elseif(geodir_is_page('listing-success')){
|
|
| 1913 | 1923 | $gd_page = 'listing-success'; |
| 1914 | 1924 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
|
| 1915 | 1925 | } |
@@ -1987,11 +1997,13 @@ discard block |
||
| 1987 | 1997 | |
| 1988 | 1998 | if (!get_option('geodir_remove_url_seperator')) {
|
| 1989 | 1999 | |
| 1990 | - if (get_option('geodir_listingurl_separator'))
|
|
| 1991 | - delete_option('geodir_listingurl_separator');
|
|
| 2000 | + if (get_option('geodir_listingurl_separator')) { |
|
| 2001 | + delete_option('geodir_listingurl_separator'); |
|
| 2002 | + } |
|
| 1992 | 2003 | |
| 1993 | - if (get_option('geodir_detailurl_separator'))
|
|
| 1994 | - delete_option('geodir_detailurl_separator');
|
|
| 2004 | + if (get_option('geodir_detailurl_separator')) { |
|
| 2005 | + delete_option('geodir_detailurl_separator'); |
|
| 2006 | + } |
|
| 1995 | 2007 | |
| 1996 | 2008 | flush_rewrite_rules(false); |
| 1997 | 2009 | |
@@ -2015,8 +2027,9 @@ discard block |
||
| 2015 | 2027 | {
|
| 2016 | 2028 | foreach ($permalink_arr as $key => $value) {
|
| 2017 | 2029 | |
| 2018 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
| 2019 | - unset($permalink_arr[$key]); |
|
| 2030 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') { |
|
| 2031 | + unset($permalink_arr[$key]); |
|
| 2032 | + } |
|
| 2020 | 2033 | |
| 2021 | 2034 | } |
| 2022 | 2035 | |
@@ -2151,16 +2164,18 @@ discard block |
||
| 2151 | 2164 | |
| 2152 | 2165 | $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
|
| 2153 | 2166 | |
| 2154 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
| 2155 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
| 2167 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') { |
|
| 2168 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
| 2169 | + } |
|
| 2156 | 2170 | } |
| 2157 | 2171 | |
| 2158 | 2172 | if (array_key_exists('special_offers', $tabs_arr)) {
|
| 2159 | 2173 | |
| 2160 | 2174 | $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
|
| 2161 | 2175 | |
| 2162 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
| 2163 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
| 2176 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') { |
|
| 2177 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
| 2178 | + } |
|
| 2164 | 2179 | } |
| 2165 | 2180 | |
| 2166 | 2181 | } |
@@ -2215,8 +2230,9 @@ discard block |
||
| 2215 | 2230 | |
| 2216 | 2231 | $all_postypes = geodir_get_posttypes(); |
| 2217 | 2232 | |
| 2218 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
| 2219 | - return false; |
|
| 2233 | + if (!in_array($post_type, $all_postypes) || !is_admin()) { |
|
| 2234 | + return false; |
|
| 2235 | + } |
|
| 2220 | 2236 | |
| 2221 | 2237 | $uploads = wp_upload_dir(); |
| 2222 | 2238 | |
@@ -2290,8 +2306,9 @@ discard block |
||
| 2290 | 2306 | $file_info = pathinfo($attach->file); |
| 2291 | 2307 | |
| 2292 | 2308 | $sub_dir = ''; |
| 2293 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 2294 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 2309 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 2310 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 2311 | + } |
|
| 2295 | 2312 | |
| 2296 | 2313 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 2297 | 2314 | $uploads_path = $uploads['basedir']; |
@@ -2312,8 +2329,9 @@ discard block |
||
| 2312 | 2329 | |
| 2313 | 2330 | if (!empty($attachment_data)) {
|
| 2314 | 2331 | |
| 2315 | - if ($attachment_data->ID) |
|
| 2316 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2332 | + if ($attachment_data->ID) { |
|
| 2333 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
| 2334 | + } |
|
| 2317 | 2335 | |
| 2318 | 2336 | } else {
|
| 2319 | 2337 | |
@@ -2566,8 +2584,9 @@ discard block |
||
| 2566 | 2584 | break; |
| 2567 | 2585 | case 'time': {
|
| 2568 | 2586 | $value = ''; |
| 2569 | - if ($post->{$type['htmlvar_name']} != '')
|
|
| 2570 | - $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
|
|
| 2587 | + if ($post->{$type['htmlvar_name']} != '') { |
|
| 2588 | + $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']})); |
|
| 2589 | + } |
|
| 2571 | 2590 | |
| 2572 | 2591 | if (strpos($field_icon, 'http') !== false) {
|
| 2573 | 2592 | $field_icon_af = ''; |
@@ -2604,13 +2623,14 @@ discard block |
||
| 2604 | 2623 | $date_format = str_replace($search, $replace, $date_format); |
| 2605 | 2624 | |
| 2606 | 2625 | $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
|
| 2607 | - }else{
|
|
| 2626 | + } else{
|
|
| 2608 | 2627 | $post_htmlvar_value = $post->{$type['htmlvar_name']};
|
| 2609 | 2628 | } |
| 2610 | 2629 | |
| 2611 | 2630 | $value = ''; |
| 2612 | - if ($post->{$type['htmlvar_name']} != '')
|
|
| 2613 | - $value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
| 2631 | + if ($post->{$type['htmlvar_name']} != '') { |
|
| 2632 | + $value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
| 2633 | + } |
|
| 2614 | 2634 | |
| 2615 | 2635 | if (strpos($field_icon, 'http') !== false) {
|
| 2616 | 2636 | $field_icon_af = ''; |