|
@@ -124,7 +124,7 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
{
|
|
125
|
125
|
global $wpdb;
|
|
126
|
126
|
|
|
127
|
|
- $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
|
|
|
127
|
+ $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
|
|
128
|
128
|
|
|
129
|
129
|
$ISO2 = array();
|
|
130
|
130
|
$countries = array();
|
|
@@ -136,11 +136,11 @@ discard block |
|
|
block discarded – undo |
|
136
|
136
|
|
|
137
|
137
|
asort($countries);
|
|
138
|
138
|
|
|
139
|
|
- $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
|
|
|
139
|
+ $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
|
|
140
|
140
|
foreach ($countries as $country => $name) {
|
|
141
|
141
|
$ccode = $ISO2[$country];
|
|
142
|
142
|
|
|
143
|
|
- $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
|
|
|
143
|
+ $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
|
|
144
|
144
|
}
|
|
145
|
145
|
|
|
146
|
146
|
echo $out_put;
|
|
@@ -182,10 +182,10 @@ discard block |
|
|
block discarded – undo |
|
182
|
182
|
if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
|
|
183
|
183
|
|
|
184
|
184
|
foreach ($posttype as $posttypeobj) {
|
|
185
|
|
- $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
|
|
|
185
|
+ $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
|
|
186
|
186
|
|
|
187
|
187
|
$sql = $wpdb->prepare(
|
|
188
|
|
- "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
|
|
|
188
|
+ "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
|
|
189
|
189
|
array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
|
|
190
|
190
|
);
|
|
191
|
191
|
$wpdb->query($sql);
|
|
@@ -233,7 +233,7 @@ discard block |
|
|
block discarded – undo |
|
233
|
233
|
*
|
|
234
|
234
|
* @since 1.0.0
|
|
235
|
235
|
*/
|
|
236
|
|
- $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
|
236
|
+ $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
237
|
237
|
'country' => $location_country,
|
|
238
|
238
|
'region' => $location_region,
|
|
239
|
239
|
'city' => $location_city,
|
|
@@ -295,7 +295,7 @@ discard block |
|
|
block discarded – undo |
|
295
|
295
|
*/
|
|
296
|
296
|
function geodir_get_address_by_lat_lan($lat, $lng)
|
|
297
|
297
|
{
|
|
298
|
|
- $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
|
|
|
298
|
+ $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng);
|
|
299
|
299
|
|
|
300
|
300
|
$ch = curl_init();
|
|
301
|
301
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
@@ -388,7 +388,7 @@ discard block |
|
|
block discarded – undo |
|
388
|
388
|
* @param string $location_array_from Source type of location terms. Default session.
|
|
389
|
389
|
* @param string $gd_post_type WP post type.
|
|
390
|
390
|
*/
|
|
391
|
|
- $location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
|
|
|
391
|
+ $location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
|
|
392
|
392
|
|
|
393
|
393
|
return $location_array;
|
|
394
|
394
|
|
|
@@ -434,7 +434,7 @@ discard block |
|
|
block discarded – undo |
|
434
|
434
|
*/
|
|
435
|
435
|
function geodir_get_osm_address_by_lat_lan($lat, $lng) {
|
|
436
|
436
|
$url = is_ssl() ? 'https:' : 'http:';
|
|
437
|
|
- $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
|
|
|
437
|
+ $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
|
|
438
|
438
|
|
|
439
|
439
|
$ch = curl_init();
|
|
440
|
440
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
@@ -448,9 +448,9 @@ discard block |
|
|
block discarded – undo |
|
448
|
448
|
|
|
449
|
449
|
if (!empty($data) && !empty($data->address)) {
|
|
450
|
450
|
$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
|
|
451
|
|
- $formatted_address = (array)$data->address;
|
|
|
451
|
+ $formatted_address = (array) $data->address;
|
|
452
|
452
|
|
|
453
|
|
- foreach ( $data->address as $key => $value ) {
|
|
|
453
|
+ foreach ($data->address as $key => $value) {
|
|
454
|
454
|
if (!in_array($key, $address_fields)) {
|
|
455
|
455
|
unset($formatted_address[$key]);
|
|
456
|
456
|
}
|
|
@@ -478,7 +478,7 @@ discard block |
|
|
block discarded – undo |
|
478
|
478
|
}
|
|
479
|
479
|
|
|
480
|
480
|
if (defined('POST_LOCATION_TABLE')) {
|
|
481
|
|
- $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
|
|
|
481
|
+ $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
|
|
482
|
482
|
if (!empty($rows)) {
|
|
483
|
483
|
foreach ($rows as $row) {
|
|
484
|
484
|
$translated = __($row->country, 'geodirectory');
|
|
@@ -488,7 +488,7 @@ discard block |
|
|
block discarded – undo |
|
488
|
488
|
}
|
|
489
|
489
|
}
|
|
490
|
490
|
|
|
491
|
|
- $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
|
|
|
491
|
+ $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
|
|
492
|
492
|
if (!empty($rows)) {
|
|
493
|
493
|
foreach ($rows as $row) {
|
|
494
|
494
|
$translated = __($row->country, 'geodirectory');
|
|
@@ -526,10 +526,10 @@ discard block |
|
|
block discarded – undo |
|
526
|
526
|
function geodir_get_country_iso2($country) {
|
|
527
|
527
|
global $wpdb;
|
|
528
|
528
|
|
|
529
|
|
- if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
|
529
|
+ if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
|
|
530
|
530
|
return $result;
|
|
531
|
531
|
}
|
|
532
|
|
- if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
|
532
|
+ if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
533
|
533
|
return $result;
|
|
534
|
534
|
}
|
|
535
|
535
|
|
|
@@ -548,10 +548,10 @@ discard block |
|
|
block discarded – undo |
|
548
|
548
|
function geodir_get_country_by_name($country, $iso2 = false) {
|
|
549
|
549
|
global $wpdb;
|
|
550
|
550
|
|
|
551
|
|
- if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
|
551
|
+ if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
|
|
552
|
552
|
return $result;
|
|
553
|
553
|
}
|
|
554
|
|
- if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
|
|
|
554
|
+ if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
|
|
555
|
555
|
return $result;
|
|
556
|
556
|
}
|
|
557
|
557
|
|