@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | function geodir_get_current_city_lat() |
| 11 | 11 | {
|
| 12 | - $location = geodir_get_default_location(); |
|
| 13 | - $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484'; |
|
| 12 | + $location = geodir_get_default_location(); |
|
| 13 | + $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484'; |
|
| 14 | 14 | |
| 15 | - return $lat; |
|
| 15 | + return $lat; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function geodir_get_current_city_lng() |
| 27 | 27 | {
|
| 28 | - $location = geodir_get_default_location(); |
|
| 29 | - $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786'; |
|
| 30 | - return $lng; |
|
| 28 | + $location = geodir_get_default_location(); |
|
| 29 | + $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786'; |
|
| 30 | + return $lng; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function geodir_get_default_location() |
| 42 | 42 | {
|
| 43 | - /** |
|
| 44 | - * Filter the default location. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * @package GeoDirectory |
|
| 48 | - * |
|
| 49 | - * @param string $location_result The default location object. |
|
| 50 | - */ |
|
| 51 | - return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
|
|
| 43 | + /** |
|
| 44 | + * Filter the default location. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * @package GeoDirectory |
|
| 48 | + * |
|
| 49 | + * @param string $location_result The default location object. |
|
| 50 | + */ |
|
| 51 | + return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
|
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | function geodir_is_default_location_set() |
| 62 | 62 | {
|
| 63 | - $default_location = geodir_get_default_location(); |
|
| 64 | - if (!empty($default_location)) |
|
| 65 | - return true; |
|
| 66 | - else |
|
| 67 | - return false; |
|
| 63 | + $default_location = geodir_get_default_location(); |
|
| 64 | + if (!empty($default_location)) |
|
| 65 | + return true; |
|
| 66 | + else |
|
| 67 | + return false; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | function create_location_slug($location_string) |
| 79 | 79 | {
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Filter the location slug. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - * @package GeoDirectory |
|
| 86 | - * |
|
| 87 | - * @param string $location_string Sanitized location string. |
|
| 88 | - */ |
|
| 89 | - return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
|
|
| 81 | + /** |
|
| 82 | + * Filter the location slug. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + * @package GeoDirectory |
|
| 86 | + * |
|
| 87 | + * @param string $location_string Sanitized location string. |
|
| 88 | + */ |
|
| 89 | + return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
|
|
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function geodir_get_location($id = '') |
| 102 | 102 | {
|
| 103 | - /** |
|
| 104 | - * Filter the location information. |
|
| 105 | - * |
|
| 106 | - * @since 1.0.0 |
|
| 107 | - * @package GeoDirectory |
|
| 108 | - * |
|
| 109 | - * @param string $id The location ID. |
|
| 110 | - */ |
|
| 111 | - return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
|
|
| 103 | + /** |
|
| 104 | + * Filter the location information. |
|
| 105 | + * |
|
| 106 | + * @since 1.0.0 |
|
| 107 | + * @package GeoDirectory |
|
| 108 | + * |
|
| 109 | + * @param string $id The location ID. |
|
| 110 | + */ |
|
| 111 | + return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
|
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -122,28 +122,28 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | function geodir_get_country_dl($post_country = '', $prefix = '') |
| 124 | 124 | {
|
| 125 | - global $wpdb; |
|
| 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 | - $ISO2 = array(); |
|
| 130 | - $countries = array(); |
|
| 129 | + $ISO2 = array(); |
|
| 130 | + $countries = array(); |
|
| 131 | 131 | |
| 132 | - foreach ($rows as $row) {
|
|
| 133 | - $ISO2[$row->Country] = $row->ISO2; |
|
| 134 | - $countries[$row->Country] = __($row->Country, 'geodirectory'); |
|
| 135 | - } |
|
| 132 | + foreach ($rows as $row) {
|
|
| 133 | + $ISO2[$row->Country] = $row->ISO2; |
|
| 134 | + $countries[$row->Country] = __($row->Country, 'geodirectory'); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - asort($countries); |
|
| 137 | + asort($countries); |
|
| 138 | 138 | |
| 139 | - $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
|
|
| 140 | - foreach ($countries as $country => $name) {
|
|
| 141 | - $ccode = $ISO2[$country]; |
|
| 139 | + $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
|
|
| 140 | + foreach ($countries as $country => $name) {
|
|
| 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>'; |
|
| 144 | - } |
|
| 143 | + $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>'; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - echo $out_put; |
|
| 146 | + echo $out_put; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -158,40 +158,40 @@ discard block |
||
| 158 | 158 | function geodir_location_form_submit() |
| 159 | 159 | {
|
| 160 | 160 | |
| 161 | - global $wpdb, $plugin_prefix; |
|
| 162 | - if (isset($_REQUEST['add_location'])) {
|
|
| 161 | + global $wpdb, $plugin_prefix; |
|
| 162 | + if (isset($_REQUEST['add_location'])) {
|
|
| 163 | 163 | |
| 164 | - $location_info = array( |
|
| 165 | - 'city' => $_REQUEST['city'], |
|
| 166 | - 'region' => $_REQUEST['region'], |
|
| 167 | - 'country' => $_REQUEST['country'], |
|
| 168 | - 'geo_lat' => $_REQUEST['latitude'], |
|
| 169 | - 'geo_lng' => $_REQUEST['longitude'], |
|
| 170 | - 'is_default' => $_REQUEST['is_default'], |
|
| 171 | - 'update_city' => $_REQUEST['update_city'] |
|
| 172 | - ); |
|
| 164 | + $location_info = array( |
|
| 165 | + 'city' => $_REQUEST['city'], |
|
| 166 | + 'region' => $_REQUEST['region'], |
|
| 167 | + 'country' => $_REQUEST['country'], |
|
| 168 | + 'geo_lat' => $_REQUEST['latitude'], |
|
| 169 | + 'geo_lng' => $_REQUEST['longitude'], |
|
| 170 | + 'is_default' => $_REQUEST['is_default'], |
|
| 171 | + 'update_city' => $_REQUEST['update_city'] |
|
| 172 | + ); |
|
| 173 | 173 | |
| 174 | - $old_location = geodir_get_default_location(); |
|
| 174 | + $old_location = geodir_get_default_location(); |
|
| 175 | 175 | |
| 176 | - $locationid = geodir_add_new_location($location_info); |
|
| 176 | + $locationid = geodir_add_new_location($location_info); |
|
| 177 | 177 | |
| 178 | - $default_location = geodir_get_location($locationid); |
|
| 178 | + $default_location = geodir_get_location($locationid); |
|
| 179 | 179 | |
| 180 | - //UPDATE AND DELETE LISTING |
|
| 181 | - $posttype = geodir_get_posttypes(); |
|
| 182 | - if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
|
|
| 180 | + //UPDATE AND DELETE LISTING |
|
| 181 | + $posttype = geodir_get_posttypes(); |
|
| 182 | + if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
|
|
| 183 | 183 | |
| 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 |
|
| 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 |
|
| 186 | 186 | |
| 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)", |
|
| 189 | - array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
|
| 190 | - ); |
|
| 191 | - $wpdb->query($sql); |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - } |
|
| 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)", |
|
| 189 | + array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
|
| 190 | + ); |
|
| 191 | + $wpdb->query($sql); |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -215,37 +215,37 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function geodir_add_new_location($location_info = array()) |
| 217 | 217 | {
|
| 218 | - global $wpdb; |
|
| 219 | - |
|
| 220 | - if (!empty($location_info)) {
|
|
| 221 | - $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all'; |
|
| 222 | - $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all'; |
|
| 223 | - $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all'; |
|
| 224 | - $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : ''; |
|
| 225 | - $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : ''; |
|
| 226 | - $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : ''; |
|
| 227 | - $country_slug = create_location_slug(__($location_country, 'geodirectory')); |
|
| 228 | - $region_slug = create_location_slug($location_region); |
|
| 229 | - $city_slug = create_location_slug($location_city); |
|
| 218 | + global $wpdb; |
|
| 219 | + |
|
| 220 | + if (!empty($location_info)) {
|
|
| 221 | + $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all'; |
|
| 222 | + $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all'; |
|
| 223 | + $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all'; |
|
| 224 | + $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : ''; |
|
| 225 | + $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : ''; |
|
| 226 | + $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : ''; |
|
| 227 | + $country_slug = create_location_slug(__($location_country, 'geodirectory')); |
|
| 228 | + $region_slug = create_location_slug($location_region); |
|
| 229 | + $city_slug = create_location_slug($location_city); |
|
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Filter add new location data. |
|
| 233 | - * |
|
| 234 | - * @since 1.0.0 |
|
| 235 | - */ |
|
| 236 | - $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
| 237 | - 'country' => $location_country, |
|
| 238 | - 'region' => $location_region, |
|
| 239 | - 'city' => $location_city, |
|
| 240 | - 'country_slug' => $country_slug, |
|
| 241 | - 'region_slug' => $region_slug, |
|
| 242 | - 'city_slug' => $city_slug, |
|
| 243 | - 'city_latitude' => $location_lat, |
|
| 244 | - 'city_longitude' => $location_lng, |
|
| 245 | - 'is_default' => $is_default |
|
| 246 | - )); |
|
| 247 | - |
|
| 248 | - /* // Not allowed to create country in DB : 2016-12-09 |
|
| 231 | + /** |
|
| 232 | + * Filter add new location data. |
|
| 233 | + * |
|
| 234 | + * @since 1.0.0 |
|
| 235 | + */ |
|
| 236 | + $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
| 237 | + 'country' => $location_country, |
|
| 238 | + 'region' => $location_region, |
|
| 239 | + 'city' => $location_city, |
|
| 240 | + 'country_slug' => $country_slug, |
|
| 241 | + 'region_slug' => $region_slug, |
|
| 242 | + 'city_slug' => $city_slug, |
|
| 243 | + 'city_latitude' => $location_lat, |
|
| 244 | + 'city_longitude' => $location_lng, |
|
| 245 | + 'is_default' => $is_default |
|
| 246 | + )); |
|
| 247 | + |
|
| 248 | + /* // Not allowed to create country in DB : 2016-12-09 |
|
| 249 | 249 | if ($geodir_location->country) {
|
| 250 | 250 | |
| 251 | 251 | $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
|
@@ -259,14 +259,14 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | */ |
| 261 | 261 | |
| 262 | - if ($geodir_location->is_default) |
|
| 263 | - update_option('geodir_default_location', $geodir_location);
|
|
| 262 | + if ($geodir_location->is_default) |
|
| 263 | + update_option('geodir_default_location', $geodir_location);
|
|
| 264 | 264 | |
| 265 | - return $geodir_location->location_id; |
|
| 265 | + return $geodir_location->location_id; |
|
| 266 | 266 | |
| 267 | - } else {
|
|
| 268 | - return false; |
|
| 269 | - } |
|
| 267 | + } else {
|
|
| 268 | + return false; |
|
| 269 | + } |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | function geodir_random_float($min = 0, $max = 1) |
| 282 | 282 | {
|
| 283 | - return $min + mt_rand() / mt_getrandmax() * ($max - $min); |
|
| 283 | + return $min + mt_rand() / mt_getrandmax() * ($max - $min); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
@@ -294,22 +294,22 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | function geodir_get_address_by_lat_lan($lat, $lng) |
| 296 | 296 | {
|
| 297 | - $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
| 298 | - |
|
| 299 | - $ch = curl_init(); |
|
| 300 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 301 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 302 | - curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 303 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 304 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 305 | - $response = curl_exec($ch); |
|
| 306 | - curl_close($ch); |
|
| 307 | - $data = json_decode($response); |
|
| 308 | - $status = $data->status; |
|
| 309 | - if ($status == "OK") {
|
|
| 310 | - return $data->results[0]->address_components; |
|
| 311 | - } else |
|
| 312 | - return false; |
|
| 297 | + $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
| 298 | + |
|
| 299 | + $ch = curl_init(); |
|
| 300 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 301 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 302 | + curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 303 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 304 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 305 | + $response = curl_exec($ch); |
|
| 306 | + curl_close($ch); |
|
| 307 | + $data = json_decode($response); |
|
| 308 | + $status = $data->status; |
|
| 309 | + if ($status == "OK") {
|
|
| 310 | + return $data->results[0]->address_components; |
|
| 311 | + } else |
|
| 312 | + return false; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -326,70 +326,70 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '') |
| 328 | 328 | {
|
| 329 | - global $wp, $gd_session; |
|
| 330 | - $location_array = array(); |
|
| 331 | - if ($location_array_from == 'session') {
|
|
| 332 | - if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
|
|
| 333 | - return $location_array; |
|
| 334 | - } |
|
| 329 | + global $wp, $gd_session; |
|
| 330 | + $location_array = array(); |
|
| 331 | + if ($location_array_from == 'session') {
|
|
| 332 | + if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
|
|
| 333 | + return $location_array; |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - $country = $gd_session->get('gd_country');
|
|
| 337 | - if ($country != '' && $country) |
|
| 338 | - $location_array['gd_country'] = urldecode($country); |
|
| 336 | + $country = $gd_session->get('gd_country');
|
|
| 337 | + if ($country != '' && $country) |
|
| 338 | + $location_array['gd_country'] = urldecode($country); |
|
| 339 | 339 | |
| 340 | - $region = $gd_session->get('gd_region');
|
|
| 341 | - if ($region != '' && $region) |
|
| 342 | - $location_array['gd_region'] = urldecode($region); |
|
| 340 | + $region = $gd_session->get('gd_region');
|
|
| 341 | + if ($region != '' && $region) |
|
| 342 | + $location_array['gd_region'] = urldecode($region); |
|
| 343 | 343 | |
| 344 | - $city = $gd_session->get('gd_city');
|
|
| 345 | - if ($city != '' && $city) |
|
| 346 | - $location_array['gd_city'] = urldecode($city); |
|
| 347 | - } else {
|
|
| 348 | - if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
|
|
| 349 | - return $location_array; |
|
| 350 | - } |
|
| 344 | + $city = $gd_session->get('gd_city');
|
|
| 345 | + if ($city != '' && $city) |
|
| 346 | + $location_array['gd_city'] = urldecode($city); |
|
| 347 | + } else {
|
|
| 348 | + if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
|
|
| 349 | + return $location_array; |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 352 | + $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 353 | 353 | |
| 354 | - $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 354 | + $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 355 | 355 | |
| 356 | - $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 356 | + $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 357 | 357 | |
| 358 | - if ($country != '') |
|
| 359 | - $location_array['gd_country'] = urldecode($country); |
|
| 358 | + if ($country != '') |
|
| 359 | + $location_array['gd_country'] = urldecode($country); |
|
| 360 | 360 | |
| 361 | - if ($region != '') |
|
| 362 | - $location_array['gd_region'] = urldecode($region); |
|
| 361 | + if ($region != '') |
|
| 362 | + $location_array['gd_region'] = urldecode($region); |
|
| 363 | 363 | |
| 364 | - if ($city != '') |
|
| 365 | - $location_array['gd_city'] = urldecode($city); |
|
| 364 | + if ($city != '') |
|
| 365 | + $location_array['gd_city'] = urldecode($city); |
|
| 366 | 366 | |
| 367 | 367 | // Fix category link in ajax popular category widget on change post type |
| 368 | 368 | if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
|
| 369 | 369 | $location_array = geodir_get_current_location_terms('session');
|
| 370 | 370 | } |
| 371 | - } |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Filter the location terms. |
| 375 | 375 | * |
| 376 | 376 | * @since 1.4.6 |
| 377 | - * @package GeoDirectory |
|
| 377 | + * @package GeoDirectory |
|
| 378 | + * |
|
| 379 | + * @param array $location_array {
|
|
| 380 | + * Attributes of the location_array. |
|
| 381 | + * |
|
| 382 | + * @type string $gd_country The country slug. |
|
| 383 | + * @type string $gd_region The region slug. |
|
| 384 | + * @type string $gd_city The city slug. |
|
| 378 | 385 | * |
| 379 | - * @param array $location_array {
|
|
| 380 | - * Attributes of the location_array. |
|
| 381 | - * |
|
| 382 | - * @type string $gd_country The country slug. |
|
| 383 | - * @type string $gd_region The region slug. |
|
| 384 | - * @type string $gd_city The city slug. |
|
| 385 | - * |
|
| 386 | - * } |
|
| 386 | + * } |
|
| 387 | 387 | * @param string $location_array_from Source type of location terms. Default session. |
| 388 | 388 | * @param string $gd_post_type WP post type. |
| 389 | 389 | */ |
| 390 | 390 | $location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type ); |
| 391 | 391 | |
| 392 | - return $location_array; |
|
| 392 | + return $location_array; |
|
| 393 | 393 | |
| 394 | 394 | } |
| 395 | 395 | |
@@ -402,24 +402,24 @@ discard block |
||
| 402 | 402 | * @return bool|string |
| 403 | 403 | */ |
| 404 | 404 | function geodir_get_location_link($which_location = 'current') {
|
| 405 | - $location_link = get_permalink(geodir_location_page_id()); |
|
| 406 | - |
|
| 407 | - if ($which_location == 'base') {
|
|
| 408 | - return $location_link; |
|
| 409 | - } else {
|
|
| 410 | - $location_terms = geodir_get_current_location_terms(); |
|
| 411 | - |
|
| 412 | - if (!empty($location_terms)) {
|
|
| 413 | - if (get_option('permalink_structure') != '') {
|
|
| 414 | - $location_terms = implode("/", $location_terms);
|
|
| 415 | - $location_terms = rtrim($location_terms, '/'); |
|
| 416 | - $location_link .= $location_terms; |
|
| 417 | - } else {
|
|
| 418 | - $location_link = geodir_getlink($location_link, $location_terms); |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - } |
|
| 422 | - return $location_link; |
|
| 405 | + $location_link = get_permalink(geodir_location_page_id()); |
|
| 406 | + |
|
| 407 | + if ($which_location == 'base') {
|
|
| 408 | + return $location_link; |
|
| 409 | + } else {
|
|
| 410 | + $location_terms = geodir_get_current_location_terms(); |
|
| 411 | + |
|
| 412 | + if (!empty($location_terms)) {
|
|
| 413 | + if (get_option('permalink_structure') != '') {
|
|
| 414 | + $location_terms = implode("/", $location_terms);
|
|
| 415 | + $location_terms = rtrim($location_terms, '/'); |
|
| 416 | + $location_link .= $location_terms; |
|
| 417 | + } else {
|
|
| 418 | + $location_link = geodir_getlink($location_link, $location_terms); |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + } |
|
| 422 | + return $location_link; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
@@ -432,34 +432,34 @@ discard block |
||
| 432 | 432 | * @return array|bool Returns address on success. |
| 433 | 433 | */ |
| 434 | 434 | function geodir_get_osm_address_by_lat_lan($lat, $lng) {
|
| 435 | - $url = is_ssl() ? 'https:' : 'http:'; |
|
| 436 | - $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
|
|
| 437 | - |
|
| 438 | - $ch = curl_init(); |
|
| 439 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 440 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 441 | - curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 442 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 443 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 444 | - $response = curl_exec($ch); |
|
| 445 | - curl_close($ch); |
|
| 446 | - $data = json_decode($response); |
|
| 435 | + $url = is_ssl() ? 'https:' : 'http:'; |
|
| 436 | + $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
|
|
| 437 | + |
|
| 438 | + $ch = curl_init(); |
|
| 439 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 440 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 441 | + curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 442 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 443 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 444 | + $response = curl_exec($ch); |
|
| 445 | + curl_close($ch); |
|
| 446 | + $data = json_decode($response); |
|
| 447 | 447 | |
| 448 | - if (!empty($data) && !empty($data->address)) {
|
|
| 449 | - $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
|
|
| 450 | - $formatted_address = (array)$data->address; |
|
| 448 | + if (!empty($data) && !empty($data->address)) {
|
|
| 449 | + $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
|
|
| 450 | + $formatted_address = (array)$data->address; |
|
| 451 | 451 | |
| 452 | - foreach ( $data->address as $key => $value ) {
|
|
| 453 | - if (!in_array($key, $address_fields)) {
|
|
| 454 | - unset($formatted_address[$key]); |
|
| 455 | - } |
|
| 456 | - } |
|
| 457 | - $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
|
|
| 452 | + foreach ( $data->address as $key => $value ) {
|
|
| 453 | + if (!in_array($key, $address_fields)) {
|
|
| 454 | + unset($formatted_address[$key]); |
|
| 455 | + } |
|
| 456 | + } |
|
| 457 | + $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
|
|
| 458 | 458 | |
| 459 | - return $data; |
|
| 460 | - } else {
|
|
| 461 | - return false; |
|
| 462 | - } |
|
| 459 | + return $data; |
|
| 460 | + } else {
|
|
| 461 | + return false; |
|
| 462 | + } |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -471,47 +471,47 @@ discard block |
||
| 471 | 471 | * @return string Returns the country. |
| 472 | 472 | */ |
| 473 | 473 | function geodir_get_normal_country($country) {
|
| 474 | - global $wpdb; |
|
| 475 | - if ($result = geodir_get_country_by_name($country)) {
|
|
| 476 | - return $result; |
|
| 477 | - } |
|
| 474 | + global $wpdb; |
|
| 475 | + if ($result = geodir_get_country_by_name($country)) {
|
|
| 476 | + return $result; |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | - if (defined('POST_LOCATION_TABLE')) {
|
|
| 480 | - $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 | - if (!empty($rows)) {
|
|
| 482 | - foreach ($rows as $row) {
|
|
| 483 | - $translated = __($row->country, 'geodirectory'); |
|
| 484 | - if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 485 | - return $result; |
|
| 486 | - } |
|
| 487 | - } |
|
| 488 | - } |
|
| 479 | + if (defined('POST_LOCATION_TABLE')) {
|
|
| 480 | + $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 | + if (!empty($rows)) {
|
|
| 482 | + foreach ($rows as $row) {
|
|
| 483 | + $translated = __($row->country, 'geodirectory'); |
|
| 484 | + if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 485 | + return $result; |
|
| 486 | + } |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | - $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 | - if (!empty($rows)) {
|
|
| 492 | - foreach ($rows as $row) {
|
|
| 493 | - $translated = __($row->country, 'geodirectory'); |
|
| 494 | - if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 495 | - return $result; |
|
| 496 | - } |
|
| 497 | - } |
|
| 498 | - } |
|
| 499 | - } |
|
| 490 | + $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 | + if (!empty($rows)) {
|
|
| 492 | + foreach ($rows as $row) {
|
|
| 493 | + $translated = __($row->country, 'geodirectory'); |
|
| 494 | + if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 495 | + return $result; |
|
| 496 | + } |
|
| 497 | + } |
|
| 498 | + } |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - $default_location = geodir_get_default_location(); |
|
| 502 | - if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
|
|
| 503 | - return $result; |
|
| 504 | - } |
|
| 501 | + $default_location = geodir_get_default_location(); |
|
| 502 | + if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
|
|
| 503 | + return $result; |
|
| 504 | + } |
|
| 505 | 505 | |
| 506 | - if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
|
|
| 507 | - return $result; |
|
| 508 | - } |
|
| 506 | + if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
|
|
| 507 | + return $result; |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | - if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
|
|
| 511 | - return $result; |
|
| 512 | - } |
|
| 510 | + if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
|
|
| 511 | + return $result; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - return $country; |
|
| 514 | + return $country; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | * @return string Country ISO2 code. |
| 524 | 524 | */ |
| 525 | 525 | function geodir_get_country_iso2($country) {
|
| 526 | - global $wpdb; |
|
| 526 | + global $wpdb; |
|
| 527 | 527 | |
| 528 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 529 | - return $result; |
|
| 530 | - } |
|
| 531 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
| 532 | - return $result; |
|
| 533 | - } |
|
| 528 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 529 | + return $result; |
|
| 530 | + } |
|
| 531 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
| 532 | + return $result; |
|
| 533 | + } |
|
| 534 | 534 | |
| 535 | - return $country; |
|
| 535 | + return $country; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /** |
@@ -545,16 +545,16 @@ discard block |
||
| 545 | 545 | * @return string|null Country ISO2 code. |
| 546 | 546 | */ |
| 547 | 547 | function geodir_get_country_by_name($country, $iso2 = false) {
|
| 548 | - global $wpdb; |
|
| 548 | + global $wpdb; |
|
| 549 | 549 | |
| 550 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 551 | - return $result; |
|
| 552 | - } |
|
| 553 | - if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
|
|
| 554 | - return $result; |
|
| 555 | - } |
|
| 550 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 551 | + return $result; |
|
| 552 | + } |
|
| 553 | + if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
|
|
| 554 | + return $result; |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | - return NULL; |
|
| 557 | + return NULL; |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | |
@@ -573,125 +573,125 @@ discard block |
||
| 573 | 573 | * @return string Filtered content. |
| 574 | 574 | */ |
| 575 | 575 | function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
|
| 576 | - global $wp; |
|
| 576 | + global $wp; |
|
| 577 | 577 | |
| 578 | - if (empty($content)) {
|
|
| 579 | - return $content; |
|
| 580 | - } |
|
| 578 | + if (empty($content)) {
|
|
| 579 | + return $content; |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | - $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
|
|
| 582 | + $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
|
|
| 583 | 583 | |
| 584 | - if (empty($location_array)) {
|
|
| 585 | - $location_array = geodir_get_current_location_terms('query_vars');
|
|
| 586 | - } |
|
| 584 | + if (empty($location_array)) {
|
|
| 585 | + $location_array = geodir_get_current_location_terms('query_vars');
|
|
| 586 | + } |
|
| 587 | 587 | |
| 588 | - $location_terms = array(); |
|
| 589 | - $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : ''; |
|
| 590 | - $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : ''; |
|
| 591 | - $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : ''; |
|
| 592 | - $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : ''; |
|
| 593 | - |
|
| 594 | - $location_names = array(); |
|
| 595 | - foreach ($location_terms as $type => $location) {
|
|
| 596 | - $location_name = $location; |
|
| 588 | + $location_terms = array(); |
|
| 589 | + $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : ''; |
|
| 590 | + $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : ''; |
|
| 591 | + $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : ''; |
|
| 592 | + $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : ''; |
|
| 593 | + |
|
| 594 | + $location_names = array(); |
|
| 595 | + foreach ($location_terms as $type => $location) {
|
|
| 596 | + $location_name = $location; |
|
| 597 | 597 | |
| 598 | - if (!empty($location_name)) {
|
|
| 599 | - if ($location_manager) {
|
|
| 600 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 601 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
| 602 | - } else {
|
|
| 603 | - $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
| 604 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 605 | - $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 606 | - } |
|
| 607 | - } |
|
| 598 | + if (!empty($location_name)) {
|
|
| 599 | + if ($location_manager) {
|
|
| 600 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 601 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
| 602 | + } else {
|
|
| 603 | + $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
| 604 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 605 | + $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 606 | + } |
|
| 607 | + } |
|
| 608 | 608 | |
| 609 | - $location_names[$type] = $location_name; |
|
| 610 | - } |
|
| 609 | + $location_names[$type] = $location_name; |
|
| 610 | + } |
|
| 611 | 611 | |
| 612 | - $location_single = ''; |
|
| 613 | - foreach ($location_terms as $type => $location) {
|
|
| 614 | - if (!empty($location)) {
|
|
| 615 | - if (!empty($location_names[$type])) {
|
|
| 616 | - $location_single = $location_names[$type]; |
|
| 617 | - } else {
|
|
| 618 | - if ($location_manager) {
|
|
| 619 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 620 | - $location_single = get_actual_location_name($location_type, $location, true); |
|
| 621 | - } else {
|
|
| 622 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 623 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 624 | - $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 625 | - } |
|
| 626 | - } |
|
| 627 | - break; |
|
| 628 | - } |
|
| 629 | - } |
|
| 612 | + $location_single = ''; |
|
| 613 | + foreach ($location_terms as $type => $location) {
|
|
| 614 | + if (!empty($location)) {
|
|
| 615 | + if (!empty($location_names[$type])) {
|
|
| 616 | + $location_single = $location_names[$type]; |
|
| 617 | + } else {
|
|
| 618 | + if ($location_manager) {
|
|
| 619 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 620 | + $location_single = get_actual_location_name($location_type, $location, true); |
|
| 621 | + } else {
|
|
| 622 | + $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 623 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 624 | + $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 625 | + } |
|
| 626 | + } |
|
| 627 | + break; |
|
| 628 | + } |
|
| 629 | + } |
|
| 630 | 630 | |
| 631 | - $full_location = array(); |
|
| 632 | - if (!empty($location_array)) {
|
|
| 633 | - $location_array = array_reverse($location_array); |
|
| 634 | - |
|
| 635 | - foreach ($location_array as $type => $location) {
|
|
| 636 | - if (!empty($location_names[$type])) {
|
|
| 637 | - $location_name = $location_names[$type]; |
|
| 638 | - } else {
|
|
| 639 | - if ($location_manager) {
|
|
| 640 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 641 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
| 642 | - } else {
|
|
| 643 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 644 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 645 | - $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 646 | - } |
|
| 647 | - } |
|
| 648 | - |
|
| 649 | - $full_location[] = $location_name; |
|
| 650 | - } |
|
| 631 | + $full_location = array(); |
|
| 632 | + if (!empty($location_array)) {
|
|
| 633 | + $location_array = array_reverse($location_array); |
|
| 634 | + |
|
| 635 | + foreach ($location_array as $type => $location) {
|
|
| 636 | + if (!empty($location_names[$type])) {
|
|
| 637 | + $location_name = $location_names[$type]; |
|
| 638 | + } else {
|
|
| 639 | + if ($location_manager) {
|
|
| 640 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 641 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
| 642 | + } else {
|
|
| 643 | + $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 644 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 645 | + $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 646 | + } |
|
| 647 | + } |
|
| 648 | + |
|
| 649 | + $full_location[] = $location_name; |
|
| 650 | + } |
|
| 651 | 651 | |
| 652 | - if (!empty($full_location)) {
|
|
| 653 | - $full_location = array_unique($full_location); |
|
| 654 | - } |
|
| 655 | - } |
|
| 656 | - $full_location = !empty($full_location) ? implode(', ', $full_location): '';
|
|
| 652 | + if (!empty($full_location)) {
|
|
| 653 | + $full_location = array_unique($full_location); |
|
| 654 | + } |
|
| 655 | + } |
|
| 656 | + $full_location = !empty($full_location) ? implode(', ', $full_location): '';
|
|
| 657 | 657 | |
| 658 | - $location_replace_vars = array(); |
|
| 659 | - $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
|
| 660 | - $location_replace_vars['%%location%%'] = $full_location; |
|
| 661 | - $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
| 662 | - $location_replace_vars['%%location_single%%'] = $location_single; |
|
| 663 | - $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
| 658 | + $location_replace_vars = array(); |
|
| 659 | + $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
|
| 660 | + $location_replace_vars['%%location%%'] = $full_location; |
|
| 661 | + $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
| 662 | + $location_replace_vars['%%location_single%%'] = $location_single; |
|
| 663 | + $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
| 664 | 664 | |
| 665 | - foreach ($location_names as $type => $name) {
|
|
| 666 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 665 | + foreach ($location_names as $type => $name) {
|
|
| 666 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 667 | 667 | |
| 668 | - $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
| 669 | - $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
| 670 | - } |
|
| 671 | - |
|
| 672 | - /** |
|
| 673 | - * Filter the location terms variables to search & replace. |
|
| 674 | - * |
|
| 675 | - * @since 1.6.16 |
|
| 676 | - * @package GeoDirectory |
|
| 677 | - * |
|
| 678 | - * @param array $location_replace_vars The array of search & replace variables. |
|
| 679 | - * @param string $content The content with variables. |
|
| 680 | - * @param array $location_array The array of location variables. |
|
| 681 | - * @param string $gd_page The page being filtered. |
|
| 682 | - * @param string $sep The separator. |
|
| 683 | - */ |
|
| 684 | - $location_replace_vars = apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $content, $location_array, $gd_page, $sep ); |
|
| 685 | - |
|
| 686 | - if (!empty($location_replace_vars)) {
|
|
| 687 | - foreach ($location_replace_vars as $search => $replace) {
|
|
| 688 | - if (!empty($search) && strpos($content, $search) !== false) {
|
|
| 689 | - $content = str_replace($search, $replace, $content); |
|
| 690 | - } |
|
| 691 | - } |
|
| 692 | - } |
|
| 668 | + $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
| 669 | + $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
| 670 | + } |
|
| 671 | + |
|
| 672 | + /** |
|
| 673 | + * Filter the location terms variables to search & replace. |
|
| 674 | + * |
|
| 675 | + * @since 1.6.16 |
|
| 676 | + * @package GeoDirectory |
|
| 677 | + * |
|
| 678 | + * @param array $location_replace_vars The array of search & replace variables. |
|
| 679 | + * @param string $content The content with variables. |
|
| 680 | + * @param array $location_array The array of location variables. |
|
| 681 | + * @param string $gd_page The page being filtered. |
|
| 682 | + * @param string $sep The separator. |
|
| 683 | + */ |
|
| 684 | + $location_replace_vars = apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $content, $location_array, $gd_page, $sep ); |
|
| 685 | + |
|
| 686 | + if (!empty($location_replace_vars)) {
|
|
| 687 | + foreach ($location_replace_vars as $search => $replace) {
|
|
| 688 | + if (!empty($search) && strpos($content, $search) !== false) {
|
|
| 689 | + $content = str_replace($search, $replace, $content); |
|
| 690 | + } |
|
| 691 | + } |
|
| 692 | + } |
|
| 693 | 693 | |
| 694 | - return $content; |
|
| 694 | + return $content; |
|
| 695 | 695 | } |
| 696 | 696 | add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
|
| 697 | 697 | add_filter('geodir_replace_location_variables_seo', 'geodir_replace_location_variables'); |
| 698 | 698 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $gd_wpseo_use = ''; |
| 12 | 12 | if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
| 13 | - $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />"; |
|
| 13 | + $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />"; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -21,360 +21,360 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | $geodir_settings['title_meta_settings'] = apply_filters('geodir_title_meta_settings', array( |
| 23 | 23 | |
| 24 | - /* Listing Permalink Settings start */ |
|
| 25 | - array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '), |
|
| 26 | - |
|
| 27 | - array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'), |
|
| 28 | - 'desc' => '%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%location_country%%, %%in_location_country%%, %%location_region%%, %%in_location_region%%, %%location_city%%, %%in_location_city%%, %%location_sep%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%', |
|
| 29 | - 'type' => 'sectionstart', |
|
| 30 | - 'id' => 'geodir_meta_vars'), |
|
| 31 | - |
|
| 32 | - array('type' => 'sectionend', 'id' => 'geodir_meta_vars'), |
|
| 33 | - |
|
| 34 | - array('name' => __('Homepage Meta Settings', 'geodirectory'), |
|
| 35 | - 'type' => 'sectionstart', |
|
| 36 | - 'desc' => '', |
|
| 37 | - 'id' => 'geodir_home_meta'), |
|
| 38 | - |
|
| 39 | - array( |
|
| 40 | - 'name' => __('Homepage meta title', 'geodirectory'), |
|
| 41 | - 'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'), |
|
| 42 | - 'id' => 'geodir_meta_title_homepage', |
|
| 43 | - 'type' => 'text', |
|
| 44 | - 'css' => 'width:100%;', |
|
| 45 | - 'std' => '', |
|
| 46 | - 'placeholder' => '' |
|
| 47 | - ), |
|
| 48 | - |
|
| 49 | - array( |
|
| 50 | - 'name' => __('Homepage meta description', 'geodirectory'), |
|
| 51 | - 'desc' => __('Enter the meta description for the homepage.', 'geodirectory'), |
|
| 52 | - 'id' => 'geodir_meta_desc_homepage', |
|
| 53 | - 'type' => 'textarea', |
|
| 54 | - 'css' => 'width:100%;', |
|
| 55 | - 'std' => '' |
|
| 56 | - ), |
|
| 57 | - |
|
| 58 | - array('type' => 'sectionend', 'id' => 'geodir_home_meta'), |
|
| 59 | - |
|
| 60 | - // details page meta |
|
| 61 | - array('name' => __('Details Page Meta Settings', 'geodirectory'), |
|
| 62 | - 'type' => 'sectionstart', |
|
| 63 | - 'desc' => '', |
|
| 64 | - 'id' => 'geodir_details_meta'), |
|
| 65 | - |
|
| 66 | - array( |
|
| 67 | - 'name' => __('Details page meta title', 'geodirectory'), |
|
| 68 | - 'desc' => __('Enter the meta title for the details page.', 'geodirectory'), |
|
| 69 | - 'id' => 'geodir_meta_title_detail', |
|
| 70 | - 'type' => 'text', |
|
| 71 | - 'css' => 'width:100%;', |
|
| 72 | - 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 73 | - 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
| 74 | - ), |
|
| 75 | - |
|
| 76 | - array( |
|
| 77 | - 'name' => __('Details page meta description', 'geodirectory'), |
|
| 78 | - 'desc' => __('Enter the meta description for the details page.', 'geodirectory'), |
|
| 79 | - 'id' => 'geodir_meta_desc_detail', |
|
| 80 | - 'type' => 'textarea', |
|
| 81 | - 'css' => 'width:100%;', |
|
| 82 | - 'std' => __('%%excerpt%%', 'geodirectory'), |
|
| 83 | - 'placeholder' => '%%excerpt%%' |
|
| 84 | - ), |
|
| 85 | - |
|
| 86 | - array('type' => 'sectionend', 'id' => 'geodir_details_meta'), |
|
| 87 | - |
|
| 88 | - // CPT page meta |
|
| 89 | - array('name' => __('Post Type Page Meta Settings', 'geodirectory'), |
|
| 90 | - 'type' => 'sectionstart', |
|
| 91 | - 'desc' => '', |
|
| 92 | - 'id' => 'geodir_pt_meta'), |
|
| 93 | - |
|
| 94 | - array( |
|
| 95 | - 'name' => __('Post type page meta title', 'geodirectory'), |
|
| 96 | - 'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'), |
|
| 97 | - 'id' => 'geodir_meta_title_pt', |
|
| 98 | - 'type' => 'text', |
|
| 99 | - 'css' => 'width:100%;', |
|
| 100 | - 'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 101 | - 'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%' |
|
| 102 | - ), |
|
| 103 | - |
|
| 104 | - array( |
|
| 105 | - 'name' => __('Post type page meta description', 'geodirectory'), |
|
| 106 | - 'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'), |
|
| 107 | - 'id' => 'geodir_meta_desc_pt', |
|
| 108 | - 'type' => 'textarea', |
|
| 109 | - 'css' => 'width:100%;', |
|
| 110 | - 'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'), |
|
| 111 | - 'placeholder' => '%%pt_plural%% %%in_location%%' |
|
| 112 | - ), |
|
| 113 | - |
|
| 114 | - array( |
|
| 115 | - 'name' => __('Post type page title', 'geodirectory'), |
|
| 116 | - 'desc' => __('Enter the title for the post type pages.', 'geodirectory'), |
|
| 117 | - 'id' => 'geodir_page_title_pt', |
|
| 118 | - 'type' => 'text', |
|
| 119 | - 'css' => 'width:100%;', |
|
| 120 | - 'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'), |
|
| 121 | - 'placeholder' => 'All %%pt_plural%% %%in_location_single%%' |
|
| 122 | - ), |
|
| 123 | - |
|
| 124 | - array('type' => 'sectionend', 'id' => 'geodir_pt_meta'), |
|
| 125 | - |
|
| 126 | - // Cat listing page meta |
|
| 127 | - array('name' => __('Listing Page Meta Settings', 'geodirectory'), |
|
| 128 | - 'type' => 'sectionstart', |
|
| 129 | - 'desc' => '', |
|
| 130 | - 'id' => 'geodir_pt_meta'), |
|
| 131 | - |
|
| 132 | - array( |
|
| 133 | - 'name' => __('Listing page meta title', 'geodirectory'), |
|
| 134 | - 'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'), |
|
| 135 | - 'id' => 'geodir_meta_title_listing', |
|
| 136 | - 'type' => 'text', |
|
| 137 | - 'css' => 'width:100%;', |
|
| 138 | - 'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 139 | - 'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%' |
|
| 140 | - ), |
|
| 141 | - |
|
| 142 | - array( |
|
| 143 | - 'name' => __('Listing page meta description', 'geodirectory'), |
|
| 144 | - 'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'), |
|
| 145 | - 'id' => 'geodir_meta_desc_listing', |
|
| 146 | - 'type' => 'textarea', |
|
| 147 | - 'css' => 'width:100%;', |
|
| 148 | - 'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'), |
|
| 149 | - 'placeholder' => 'Posts related to Category: %%category%% %%in_location%%' |
|
| 150 | - ), |
|
| 151 | - |
|
| 152 | - array( |
|
| 153 | - 'name' => __('Category listing page title', 'geodirectory'), |
|
| 154 | - 'desc' => __('Enter the title for the category listing pages.', 'geodirectory'), |
|
| 155 | - 'id' => 'geodir_page_title_cat-listing', |
|
| 156 | - 'type' => 'text', |
|
| 157 | - 'css' => 'width:100%;', |
|
| 158 | - 'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'), |
|
| 159 | - 'placeholder' => 'All %%category%% %%in_location_single%%' |
|
| 160 | - ), |
|
| 161 | - |
|
| 162 | - array( |
|
| 163 | - 'name' => __('Tag listing page title', 'geodirectory'), |
|
| 164 | - 'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'), |
|
| 165 | - 'id' => 'geodir_page_title_tag-listing', |
|
| 166 | - 'type' => 'text', |
|
| 167 | - 'css' => 'width:100%;', |
|
| 168 | - 'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'), |
|
| 169 | - 'placeholder' => 'Tag: %%tag%% %%in_location_single%%' |
|
| 170 | - ), |
|
| 171 | - |
|
| 172 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 173 | - |
|
| 174 | - // location page meta |
|
| 175 | - array('name' => __('Location Page Meta Settings', 'geodirectory'), |
|
| 176 | - 'type' => 'sectionstart', |
|
| 177 | - 'desc' => '', |
|
| 178 | - 'id' => 'geodir_pt_meta'), |
|
| 179 | - |
|
| 180 | - array( |
|
| 181 | - 'name' => __('Location page meta title', 'geodirectory'), |
|
| 182 | - 'desc' => __('Enter the meta title for the location pages.', 'geodirectory'), |
|
| 183 | - 'id' => 'geodir_meta_title_location', |
|
| 184 | - 'type' => 'text', |
|
| 185 | - 'css' => 'width:100%;', |
|
| 186 | - 'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 187 | - 'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%' |
|
| 188 | - ), |
|
| 189 | - |
|
| 190 | - array( |
|
| 191 | - 'name' => __('Location page meta description', 'geodirectory'), |
|
| 192 | - 'desc' => __('Enter the meta description for the location pages.', 'geodirectory'), |
|
| 193 | - 'id' => 'geodir_meta_desc_location', |
|
| 194 | - 'type' => 'textarea', |
|
| 195 | - 'css' => 'width:100%;', |
|
| 196 | - 'std' => __('%%location%%', 'geodirectory'), |
|
| 197 | - 'placeholder' => '%%location%%' |
|
| 198 | - ), |
|
| 199 | - |
|
| 200 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 201 | - |
|
| 202 | - // Search page meta |
|
| 203 | - array('name' => __('Search Page Meta Settings', 'geodirectory'), |
|
| 204 | - 'type' => 'sectionstart', |
|
| 205 | - 'desc' => '', |
|
| 206 | - 'id' => 'geodir_pt_meta'), |
|
| 207 | - |
|
| 208 | - array( |
|
| 209 | - 'name' => __('Search page meta title', 'geodirectory'), |
|
| 210 | - 'desc' => __('Enter the meta title for the search page.', 'geodirectory'), |
|
| 211 | - 'id' => 'geodir_meta_title_search', |
|
| 212 | - 'type' => 'text', |
|
| 213 | - 'css' => 'width:100%;', |
|
| 214 | - 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 215 | - 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%' |
|
| 216 | - ), |
|
| 217 | - |
|
| 218 | - array( |
|
| 219 | - 'name' => __('Search page meta description', 'geodirectory'), |
|
| 220 | - 'desc' => __('Enter the meta description for the search page.', 'geodirectory'), |
|
| 221 | - 'id' => 'geodir_meta_desc_search', |
|
| 222 | - 'type' => 'textarea', |
|
| 223 | - 'css' => 'width:100%;', |
|
| 224 | - 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'), |
|
| 225 | - 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%' |
|
| 226 | - ), |
|
| 227 | - |
|
| 228 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 229 | - |
|
| 230 | - //Add listing page meta |
|
| 231 | - array('name' => __('Add Listing Page Meta Settings', 'geodirectory'), |
|
| 232 | - 'type' => 'sectionstart', |
|
| 233 | - 'desc' => '', |
|
| 234 | - 'id' => 'geodir_pt_meta'), |
|
| 235 | - |
|
| 236 | - array( |
|
| 237 | - 'name' => __('Add listing page meta title', 'geodirectory'), |
|
| 238 | - 'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'), |
|
| 239 | - 'id' => 'geodir_meta_title_add-listing', |
|
| 240 | - 'type' => 'text', |
|
| 241 | - 'css' => 'width:100%;', |
|
| 242 | - 'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 243 | - 'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%' |
|
| 244 | - ), |
|
| 245 | - |
|
| 246 | - array( |
|
| 247 | - 'name' => __('Add listing page meta description', 'geodirectory'), |
|
| 248 | - 'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'), |
|
| 249 | - 'id' => 'geodir_meta_desc_add-listing', |
|
| 250 | - 'type' => 'textarea', |
|
| 251 | - 'css' => 'width:100%;', |
|
| 252 | - 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
| 253 | - 'placeholder' => 'Add %%pt_single%%' |
|
| 254 | - ), |
|
| 255 | - |
|
| 256 | - array( |
|
| 257 | - 'name' => __('Add listing page title', 'geodirectory'), |
|
| 258 | - 'desc' => __('Enter the title for the add listing page.', 'geodirectory'), |
|
| 259 | - 'id' => 'geodir_page_title_add-listing', |
|
| 260 | - 'type' => 'text', |
|
| 261 | - 'css' => 'width:100%;', |
|
| 262 | - 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
| 263 | - 'placeholder' => 'Add %%pt_single%%' |
|
| 264 | - ), |
|
| 265 | - |
|
| 266 | - array( |
|
| 267 | - 'name' => __('Edit listing page title', 'geodirectory'), |
|
| 268 | - 'desc' => __('Enter the title for the edit listing page.', 'geodirectory'), |
|
| 269 | - 'id' => 'geodir_page_title_edit-listing', |
|
| 270 | - 'type' => 'text', |
|
| 271 | - 'css' => 'width:100%;', |
|
| 272 | - 'std' => __('Edit %%pt_single%%', 'geodirectory'), |
|
| 273 | - 'placeholder' => 'Edit %%pt_single%%' |
|
| 274 | - ), |
|
| 275 | - |
|
| 276 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 277 | - |
|
| 278 | - //Author page meta |
|
| 279 | - array('name' => __('Author Page Meta Settings', 'geodirectory'), |
|
| 280 | - 'type' => 'sectionstart', |
|
| 281 | - 'desc' => '', |
|
| 282 | - 'id' => 'geodir_pt_meta'), |
|
| 283 | - |
|
| 284 | - array( |
|
| 285 | - 'name' => __('Author page meta title', 'geodirectory'), |
|
| 286 | - 'desc' => __('Enter the meta title for the author page.', 'geodirectory'), |
|
| 287 | - 'id' => 'geodir_meta_title_author', |
|
| 288 | - 'type' => 'text', |
|
| 289 | - 'css' => 'width:100%;', |
|
| 290 | - 'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 291 | - 'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%' |
|
| 292 | - ), |
|
| 293 | - |
|
| 294 | - array( |
|
| 295 | - 'name' => __('Author page meta description', 'geodirectory'), |
|
| 296 | - 'desc' => __('Enter the meta description for the author page.', 'geodirectory'), |
|
| 297 | - 'id' => 'geodir_meta_desc_author', |
|
| 298 | - 'type' => 'textarea', |
|
| 299 | - 'css' => 'width:100%;', |
|
| 300 | - 'std' => '' |
|
| 301 | - ), |
|
| 302 | - |
|
| 303 | - array( |
|
| 304 | - 'name' => __('Author page title', 'geodirectory'), |
|
| 305 | - 'desc' => __('Enter the title for the author page.', 'geodirectory'), |
|
| 306 | - 'id' => 'geodir_page_title_author', |
|
| 307 | - 'type' => 'text', |
|
| 308 | - 'css' => 'width:100%;', |
|
| 309 | - 'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'), |
|
| 310 | - 'placeholder' => '%%pt_plural%% by: %%name%%' |
|
| 311 | - ), |
|
| 312 | - |
|
| 313 | - array( |
|
| 314 | - 'name' => __('Author favorite page title', 'geodirectory'), |
|
| 315 | - 'desc' => __('Enter the title for the author favorite page.', 'geodirectory'), |
|
| 316 | - 'id' => 'geodir_page_title_favorite', |
|
| 317 | - 'type' => 'text', |
|
| 318 | - 'css' => 'width:100%;', |
|
| 319 | - 'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'), |
|
| 320 | - 'placeholder' => '%%name%%: Favorite %%pt_plural%%' |
|
| 321 | - ), |
|
| 322 | - |
|
| 323 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 324 | - |
|
| 325 | - //Login page meta |
|
| 326 | - array('name' => __('Login Page Meta Settings', 'geodirectory'), |
|
| 327 | - 'type' => 'sectionstart', |
|
| 328 | - 'desc' => '', |
|
| 329 | - 'id' => 'geodir_login_meta'), |
|
| 330 | - |
|
| 331 | - array( |
|
| 332 | - 'name' => __('Login page meta title', 'geodirectory'), |
|
| 333 | - 'desc' => __('Enter the meta title for the login page.', 'geodirectory'), |
|
| 334 | - 'id' => 'geodir_meta_title_login', |
|
| 335 | - 'type' => 'text', |
|
| 336 | - 'css' => 'width:100%;', |
|
| 337 | - 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 338 | - 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
| 339 | - ), |
|
| 340 | - |
|
| 341 | - array( |
|
| 342 | - 'name' => __('Login page meta description', 'geodirectory'), |
|
| 343 | - 'desc' => __('Enter the meta description for the login page.', 'geodirectory'), |
|
| 344 | - 'id' => 'geodir_meta_desc_login', |
|
| 345 | - 'type' => 'textarea', |
|
| 346 | - 'css' => 'width:100%;', |
|
| 347 | - 'std' => '' |
|
| 348 | - ), |
|
| 349 | - |
|
| 350 | - array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
| 351 | - |
|
| 352 | - //Listing success page meta |
|
| 353 | - array('name' => __('Listing Success Page Meta Settings', 'geodirectory'), |
|
| 354 | - 'type' => 'sectionstart', |
|
| 355 | - 'desc' => '', |
|
| 356 | - 'id' => 'geodir_login_meta'), |
|
| 357 | - |
|
| 358 | - array( |
|
| 359 | - 'name' => __('Listing success page meta title', 'geodirectory'), |
|
| 360 | - 'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'), |
|
| 361 | - 'id' => 'geodir_meta_title_listing-success', |
|
| 362 | - 'type' => 'text', |
|
| 363 | - 'css' => 'width:100%;', |
|
| 364 | - 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 365 | - 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
| 366 | - ), |
|
| 367 | - |
|
| 368 | - array( |
|
| 369 | - 'name' => __('Listing success page meta description', 'geodirectory'), |
|
| 370 | - 'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'), |
|
| 371 | - 'id' => 'geodir_meta_desc_listing-success', |
|
| 372 | - 'type' => 'textarea', |
|
| 373 | - 'css' => 'width:100%;', |
|
| 374 | - 'std' => '' |
|
| 375 | - ), |
|
| 376 | - |
|
| 377 | - array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
| 24 | + /* Listing Permalink Settings start */ |
|
| 25 | + array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '), |
|
| 26 | + |
|
| 27 | + array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'), |
|
| 28 | + 'desc' => '%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%location_country%%, %%in_location_country%%, %%location_region%%, %%in_location_region%%, %%location_city%%, %%in_location_city%%, %%location_sep%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%', |
|
| 29 | + 'type' => 'sectionstart', |
|
| 30 | + 'id' => 'geodir_meta_vars'), |
|
| 31 | + |
|
| 32 | + array('type' => 'sectionend', 'id' => 'geodir_meta_vars'), |
|
| 33 | + |
|
| 34 | + array('name' => __('Homepage Meta Settings', 'geodirectory'), |
|
| 35 | + 'type' => 'sectionstart', |
|
| 36 | + 'desc' => '', |
|
| 37 | + 'id' => 'geodir_home_meta'), |
|
| 38 | + |
|
| 39 | + array( |
|
| 40 | + 'name' => __('Homepage meta title', 'geodirectory'), |
|
| 41 | + 'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'), |
|
| 42 | + 'id' => 'geodir_meta_title_homepage', |
|
| 43 | + 'type' => 'text', |
|
| 44 | + 'css' => 'width:100%;', |
|
| 45 | + 'std' => '', |
|
| 46 | + 'placeholder' => '' |
|
| 47 | + ), |
|
| 48 | + |
|
| 49 | + array( |
|
| 50 | + 'name' => __('Homepage meta description', 'geodirectory'), |
|
| 51 | + 'desc' => __('Enter the meta description for the homepage.', 'geodirectory'), |
|
| 52 | + 'id' => 'geodir_meta_desc_homepage', |
|
| 53 | + 'type' => 'textarea', |
|
| 54 | + 'css' => 'width:100%;', |
|
| 55 | + 'std' => '' |
|
| 56 | + ), |
|
| 57 | + |
|
| 58 | + array('type' => 'sectionend', 'id' => 'geodir_home_meta'), |
|
| 59 | + |
|
| 60 | + // details page meta |
|
| 61 | + array('name' => __('Details Page Meta Settings', 'geodirectory'), |
|
| 62 | + 'type' => 'sectionstart', |
|
| 63 | + 'desc' => '', |
|
| 64 | + 'id' => 'geodir_details_meta'), |
|
| 65 | + |
|
| 66 | + array( |
|
| 67 | + 'name' => __('Details page meta title', 'geodirectory'), |
|
| 68 | + 'desc' => __('Enter the meta title for the details page.', 'geodirectory'), |
|
| 69 | + 'id' => 'geodir_meta_title_detail', |
|
| 70 | + 'type' => 'text', |
|
| 71 | + 'css' => 'width:100%;', |
|
| 72 | + 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 73 | + 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
| 74 | + ), |
|
| 75 | + |
|
| 76 | + array( |
|
| 77 | + 'name' => __('Details page meta description', 'geodirectory'), |
|
| 78 | + 'desc' => __('Enter the meta description for the details page.', 'geodirectory'), |
|
| 79 | + 'id' => 'geodir_meta_desc_detail', |
|
| 80 | + 'type' => 'textarea', |
|
| 81 | + 'css' => 'width:100%;', |
|
| 82 | + 'std' => __('%%excerpt%%', 'geodirectory'), |
|
| 83 | + 'placeholder' => '%%excerpt%%' |
|
| 84 | + ), |
|
| 85 | + |
|
| 86 | + array('type' => 'sectionend', 'id' => 'geodir_details_meta'), |
|
| 87 | + |
|
| 88 | + // CPT page meta |
|
| 89 | + array('name' => __('Post Type Page Meta Settings', 'geodirectory'), |
|
| 90 | + 'type' => 'sectionstart', |
|
| 91 | + 'desc' => '', |
|
| 92 | + 'id' => 'geodir_pt_meta'), |
|
| 93 | + |
|
| 94 | + array( |
|
| 95 | + 'name' => __('Post type page meta title', 'geodirectory'), |
|
| 96 | + 'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'), |
|
| 97 | + 'id' => 'geodir_meta_title_pt', |
|
| 98 | + 'type' => 'text', |
|
| 99 | + 'css' => 'width:100%;', |
|
| 100 | + 'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 101 | + 'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%' |
|
| 102 | + ), |
|
| 103 | + |
|
| 104 | + array( |
|
| 105 | + 'name' => __('Post type page meta description', 'geodirectory'), |
|
| 106 | + 'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'), |
|
| 107 | + 'id' => 'geodir_meta_desc_pt', |
|
| 108 | + 'type' => 'textarea', |
|
| 109 | + 'css' => 'width:100%;', |
|
| 110 | + 'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'), |
|
| 111 | + 'placeholder' => '%%pt_plural%% %%in_location%%' |
|
| 112 | + ), |
|
| 113 | + |
|
| 114 | + array( |
|
| 115 | + 'name' => __('Post type page title', 'geodirectory'), |
|
| 116 | + 'desc' => __('Enter the title for the post type pages.', 'geodirectory'), |
|
| 117 | + 'id' => 'geodir_page_title_pt', |
|
| 118 | + 'type' => 'text', |
|
| 119 | + 'css' => 'width:100%;', |
|
| 120 | + 'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'), |
|
| 121 | + 'placeholder' => 'All %%pt_plural%% %%in_location_single%%' |
|
| 122 | + ), |
|
| 123 | + |
|
| 124 | + array('type' => 'sectionend', 'id' => 'geodir_pt_meta'), |
|
| 125 | + |
|
| 126 | + // Cat listing page meta |
|
| 127 | + array('name' => __('Listing Page Meta Settings', 'geodirectory'), |
|
| 128 | + 'type' => 'sectionstart', |
|
| 129 | + 'desc' => '', |
|
| 130 | + 'id' => 'geodir_pt_meta'), |
|
| 131 | + |
|
| 132 | + array( |
|
| 133 | + 'name' => __('Listing page meta title', 'geodirectory'), |
|
| 134 | + 'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'), |
|
| 135 | + 'id' => 'geodir_meta_title_listing', |
|
| 136 | + 'type' => 'text', |
|
| 137 | + 'css' => 'width:100%;', |
|
| 138 | + 'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 139 | + 'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%' |
|
| 140 | + ), |
|
| 141 | + |
|
| 142 | + array( |
|
| 143 | + 'name' => __('Listing page meta description', 'geodirectory'), |
|
| 144 | + 'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'), |
|
| 145 | + 'id' => 'geodir_meta_desc_listing', |
|
| 146 | + 'type' => 'textarea', |
|
| 147 | + 'css' => 'width:100%;', |
|
| 148 | + 'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'), |
|
| 149 | + 'placeholder' => 'Posts related to Category: %%category%% %%in_location%%' |
|
| 150 | + ), |
|
| 151 | + |
|
| 152 | + array( |
|
| 153 | + 'name' => __('Category listing page title', 'geodirectory'), |
|
| 154 | + 'desc' => __('Enter the title for the category listing pages.', 'geodirectory'), |
|
| 155 | + 'id' => 'geodir_page_title_cat-listing', |
|
| 156 | + 'type' => 'text', |
|
| 157 | + 'css' => 'width:100%;', |
|
| 158 | + 'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'), |
|
| 159 | + 'placeholder' => 'All %%category%% %%in_location_single%%' |
|
| 160 | + ), |
|
| 161 | + |
|
| 162 | + array( |
|
| 163 | + 'name' => __('Tag listing page title', 'geodirectory'), |
|
| 164 | + 'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'), |
|
| 165 | + 'id' => 'geodir_page_title_tag-listing', |
|
| 166 | + 'type' => 'text', |
|
| 167 | + 'css' => 'width:100%;', |
|
| 168 | + 'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'), |
|
| 169 | + 'placeholder' => 'Tag: %%tag%% %%in_location_single%%' |
|
| 170 | + ), |
|
| 171 | + |
|
| 172 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 173 | + |
|
| 174 | + // location page meta |
|
| 175 | + array('name' => __('Location Page Meta Settings', 'geodirectory'), |
|
| 176 | + 'type' => 'sectionstart', |
|
| 177 | + 'desc' => '', |
|
| 178 | + 'id' => 'geodir_pt_meta'), |
|
| 179 | + |
|
| 180 | + array( |
|
| 181 | + 'name' => __('Location page meta title', 'geodirectory'), |
|
| 182 | + 'desc' => __('Enter the meta title for the location pages.', 'geodirectory'), |
|
| 183 | + 'id' => 'geodir_meta_title_location', |
|
| 184 | + 'type' => 'text', |
|
| 185 | + 'css' => 'width:100%;', |
|
| 186 | + 'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 187 | + 'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%' |
|
| 188 | + ), |
|
| 189 | + |
|
| 190 | + array( |
|
| 191 | + 'name' => __('Location page meta description', 'geodirectory'), |
|
| 192 | + 'desc' => __('Enter the meta description for the location pages.', 'geodirectory'), |
|
| 193 | + 'id' => 'geodir_meta_desc_location', |
|
| 194 | + 'type' => 'textarea', |
|
| 195 | + 'css' => 'width:100%;', |
|
| 196 | + 'std' => __('%%location%%', 'geodirectory'), |
|
| 197 | + 'placeholder' => '%%location%%' |
|
| 198 | + ), |
|
| 199 | + |
|
| 200 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 201 | + |
|
| 202 | + // Search page meta |
|
| 203 | + array('name' => __('Search Page Meta Settings', 'geodirectory'), |
|
| 204 | + 'type' => 'sectionstart', |
|
| 205 | + 'desc' => '', |
|
| 206 | + 'id' => 'geodir_pt_meta'), |
|
| 207 | + |
|
| 208 | + array( |
|
| 209 | + 'name' => __('Search page meta title', 'geodirectory'), |
|
| 210 | + 'desc' => __('Enter the meta title for the search page.', 'geodirectory'), |
|
| 211 | + 'id' => 'geodir_meta_title_search', |
|
| 212 | + 'type' => 'text', |
|
| 213 | + 'css' => 'width:100%;', |
|
| 214 | + 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 215 | + 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%' |
|
| 216 | + ), |
|
| 217 | + |
|
| 218 | + array( |
|
| 219 | + 'name' => __('Search page meta description', 'geodirectory'), |
|
| 220 | + 'desc' => __('Enter the meta description for the search page.', 'geodirectory'), |
|
| 221 | + 'id' => 'geodir_meta_desc_search', |
|
| 222 | + 'type' => 'textarea', |
|
| 223 | + 'css' => 'width:100%;', |
|
| 224 | + 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'), |
|
| 225 | + 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%' |
|
| 226 | + ), |
|
| 227 | + |
|
| 228 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 229 | + |
|
| 230 | + //Add listing page meta |
|
| 231 | + array('name' => __('Add Listing Page Meta Settings', 'geodirectory'), |
|
| 232 | + 'type' => 'sectionstart', |
|
| 233 | + 'desc' => '', |
|
| 234 | + 'id' => 'geodir_pt_meta'), |
|
| 235 | + |
|
| 236 | + array( |
|
| 237 | + 'name' => __('Add listing page meta title', 'geodirectory'), |
|
| 238 | + 'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'), |
|
| 239 | + 'id' => 'geodir_meta_title_add-listing', |
|
| 240 | + 'type' => 'text', |
|
| 241 | + 'css' => 'width:100%;', |
|
| 242 | + 'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 243 | + 'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%' |
|
| 244 | + ), |
|
| 245 | + |
|
| 246 | + array( |
|
| 247 | + 'name' => __('Add listing page meta description', 'geodirectory'), |
|
| 248 | + 'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'), |
|
| 249 | + 'id' => 'geodir_meta_desc_add-listing', |
|
| 250 | + 'type' => 'textarea', |
|
| 251 | + 'css' => 'width:100%;', |
|
| 252 | + 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
| 253 | + 'placeholder' => 'Add %%pt_single%%' |
|
| 254 | + ), |
|
| 255 | + |
|
| 256 | + array( |
|
| 257 | + 'name' => __('Add listing page title', 'geodirectory'), |
|
| 258 | + 'desc' => __('Enter the title for the add listing page.', 'geodirectory'), |
|
| 259 | + 'id' => 'geodir_page_title_add-listing', |
|
| 260 | + 'type' => 'text', |
|
| 261 | + 'css' => 'width:100%;', |
|
| 262 | + 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
| 263 | + 'placeholder' => 'Add %%pt_single%%' |
|
| 264 | + ), |
|
| 265 | + |
|
| 266 | + array( |
|
| 267 | + 'name' => __('Edit listing page title', 'geodirectory'), |
|
| 268 | + 'desc' => __('Enter the title for the edit listing page.', 'geodirectory'), |
|
| 269 | + 'id' => 'geodir_page_title_edit-listing', |
|
| 270 | + 'type' => 'text', |
|
| 271 | + 'css' => 'width:100%;', |
|
| 272 | + 'std' => __('Edit %%pt_single%%', 'geodirectory'), |
|
| 273 | + 'placeholder' => 'Edit %%pt_single%%' |
|
| 274 | + ), |
|
| 275 | + |
|
| 276 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 277 | + |
|
| 278 | + //Author page meta |
|
| 279 | + array('name' => __('Author Page Meta Settings', 'geodirectory'), |
|
| 280 | + 'type' => 'sectionstart', |
|
| 281 | + 'desc' => '', |
|
| 282 | + 'id' => 'geodir_pt_meta'), |
|
| 283 | + |
|
| 284 | + array( |
|
| 285 | + 'name' => __('Author page meta title', 'geodirectory'), |
|
| 286 | + 'desc' => __('Enter the meta title for the author page.', 'geodirectory'), |
|
| 287 | + 'id' => 'geodir_meta_title_author', |
|
| 288 | + 'type' => 'text', |
|
| 289 | + 'css' => 'width:100%;', |
|
| 290 | + 'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 291 | + 'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%' |
|
| 292 | + ), |
|
| 293 | + |
|
| 294 | + array( |
|
| 295 | + 'name' => __('Author page meta description', 'geodirectory'), |
|
| 296 | + 'desc' => __('Enter the meta description for the author page.', 'geodirectory'), |
|
| 297 | + 'id' => 'geodir_meta_desc_author', |
|
| 298 | + 'type' => 'textarea', |
|
| 299 | + 'css' => 'width:100%;', |
|
| 300 | + 'std' => '' |
|
| 301 | + ), |
|
| 302 | + |
|
| 303 | + array( |
|
| 304 | + 'name' => __('Author page title', 'geodirectory'), |
|
| 305 | + 'desc' => __('Enter the title for the author page.', 'geodirectory'), |
|
| 306 | + 'id' => 'geodir_page_title_author', |
|
| 307 | + 'type' => 'text', |
|
| 308 | + 'css' => 'width:100%;', |
|
| 309 | + 'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'), |
|
| 310 | + 'placeholder' => '%%pt_plural%% by: %%name%%' |
|
| 311 | + ), |
|
| 312 | + |
|
| 313 | + array( |
|
| 314 | + 'name' => __('Author favorite page title', 'geodirectory'), |
|
| 315 | + 'desc' => __('Enter the title for the author favorite page.', 'geodirectory'), |
|
| 316 | + 'id' => 'geodir_page_title_favorite', |
|
| 317 | + 'type' => 'text', |
|
| 318 | + 'css' => 'width:100%;', |
|
| 319 | + 'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'), |
|
| 320 | + 'placeholder' => '%%name%%: Favorite %%pt_plural%%' |
|
| 321 | + ), |
|
| 322 | + |
|
| 323 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
| 324 | + |
|
| 325 | + //Login page meta |
|
| 326 | + array('name' => __('Login Page Meta Settings', 'geodirectory'), |
|
| 327 | + 'type' => 'sectionstart', |
|
| 328 | + 'desc' => '', |
|
| 329 | + 'id' => 'geodir_login_meta'), |
|
| 330 | + |
|
| 331 | + array( |
|
| 332 | + 'name' => __('Login page meta title', 'geodirectory'), |
|
| 333 | + 'desc' => __('Enter the meta title for the login page.', 'geodirectory'), |
|
| 334 | + 'id' => 'geodir_meta_title_login', |
|
| 335 | + 'type' => 'text', |
|
| 336 | + 'css' => 'width:100%;', |
|
| 337 | + 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 338 | + 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
| 339 | + ), |
|
| 340 | + |
|
| 341 | + array( |
|
| 342 | + 'name' => __('Login page meta description', 'geodirectory'), |
|
| 343 | + 'desc' => __('Enter the meta description for the login page.', 'geodirectory'), |
|
| 344 | + 'id' => 'geodir_meta_desc_login', |
|
| 345 | + 'type' => 'textarea', |
|
| 346 | + 'css' => 'width:100%;', |
|
| 347 | + 'std' => '' |
|
| 348 | + ), |
|
| 349 | + |
|
| 350 | + array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
| 351 | + |
|
| 352 | + //Listing success page meta |
|
| 353 | + array('name' => __('Listing Success Page Meta Settings', 'geodirectory'), |
|
| 354 | + 'type' => 'sectionstart', |
|
| 355 | + 'desc' => '', |
|
| 356 | + 'id' => 'geodir_login_meta'), |
|
| 357 | + |
|
| 358 | + array( |
|
| 359 | + 'name' => __('Listing success page meta title', 'geodirectory'), |
|
| 360 | + 'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'), |
|
| 361 | + 'id' => 'geodir_meta_title_listing-success', |
|
| 362 | + 'type' => 'text', |
|
| 363 | + 'css' => 'width:100%;', |
|
| 364 | + 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
| 365 | + 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
| 366 | + ), |
|
| 367 | + |
|
| 368 | + array( |
|
| 369 | + 'name' => __('Listing success page meta description', 'geodirectory'), |
|
| 370 | + 'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'), |
|
| 371 | + 'id' => 'geodir_meta_desc_listing-success', |
|
| 372 | + 'type' => 'textarea', |
|
| 373 | + 'css' => 'width:100%;', |
|
| 374 | + 'std' => '' |
|
| 375 | + ), |
|
| 376 | + |
|
| 377 | + array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | * @return int|null Return the page ID if present or null if not. |
| 15 | 15 | */ |
| 16 | 16 | function geodir_add_listing_page_id(){ |
| 17 | - $gd_page_id = get_option('geodir_add_listing_page'); |
|
| 17 | + $gd_page_id = get_option('geodir_add_listing_page'); |
|
| 18 | 18 | |
| 19 | - if (function_exists('icl_object_id')) { |
|
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | - } |
|
| 19 | + if (function_exists('icl_object_id')) { |
|
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - return $gd_page_id; |
|
| 23 | + return $gd_page_id; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @return int|null Return the page ID if present or null if not. |
| 32 | 32 | */ |
| 33 | 33 | function geodir_preview_page_id(){ |
| 34 | - $gd_page_id = get_option('geodir_preview_page'); |
|
| 34 | + $gd_page_id = get_option('geodir_preview_page'); |
|
| 35 | 35 | |
| 36 | - if (function_exists('icl_object_id')) { |
|
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | - } |
|
| 36 | + if (function_exists('icl_object_id')) { |
|
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $gd_page_id; |
|
| 40 | + return $gd_page_id; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | * @return int|null Return the page ID if present or null if not. |
| 49 | 49 | */ |
| 50 | 50 | function geodir_success_page_id(){ |
| 51 | - $gd_page_id = get_option('geodir_success_page'); |
|
| 51 | + $gd_page_id = get_option('geodir_success_page'); |
|
| 52 | 52 | |
| 53 | - if (function_exists('icl_object_id')) { |
|
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | - } |
|
| 53 | + if (function_exists('icl_object_id')) { |
|
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return $gd_page_id; |
|
| 57 | + return $gd_page_id; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | * @return int|null Return the page ID if present or null if not. |
| 66 | 66 | */ |
| 67 | 67 | function geodir_location_page_id(){ |
| 68 | - $gd_page_id = get_option('geodir_location_page'); |
|
| 68 | + $gd_page_id = get_option('geodir_location_page'); |
|
| 69 | 69 | |
| 70 | - if (function_exists('icl_object_id')) { |
|
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | - } |
|
| 70 | + if (function_exists('icl_object_id')) { |
|
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return $gd_page_id; |
|
| 74 | + return $gd_page_id; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | * @return int|null Return the page ID if present or null if not. |
| 83 | 83 | */ |
| 84 | 84 | function geodir_home_page_id(){ |
| 85 | - $gd_page_id = get_option('geodir_home_page'); |
|
| 85 | + $gd_page_id = get_option('geodir_home_page'); |
|
| 86 | 86 | |
| 87 | - if (function_exists('icl_object_id')) { |
|
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | - } |
|
| 87 | + if (function_exists('icl_object_id')) { |
|
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return $gd_page_id; |
|
| 91 | + return $gd_page_id; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * @return int|null Return the page ID if present or null if not. |
| 100 | 100 | */ |
| 101 | 101 | function geodir_info_page_id(){ |
| 102 | - $gd_page_id = get_option('geodir_info_page'); |
|
| 102 | + $gd_page_id = get_option('geodir_info_page'); |
|
| 103 | 103 | |
| 104 | - if (function_exists('icl_object_id')) { |
|
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | - } |
|
| 104 | + if (function_exists('icl_object_id')) { |
|
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return $gd_page_id; |
|
| 108 | + return $gd_page_id; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * @return int|null Return the page ID if present or null if not. |
| 117 | 117 | */ |
| 118 | 118 | function geodir_login_page_id(){ |
| 119 | - $gd_page_id = get_option('geodir_login_page'); |
|
| 119 | + $gd_page_id = get_option('geodir_login_page'); |
|
| 120 | 120 | |
| 121 | - if (function_exists('icl_object_id')) { |
|
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | - } |
|
| 121 | + if (function_exists('icl_object_id')) { |
|
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $gd_page_id; |
|
| 125 | + return $gd_page_id; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | * @return int|null Return the page ID if present or null if not. |
| 135 | 135 | */ |
| 136 | 136 | function geodir_login_url($args=array()){ |
| 137 | - $gd_page_id = get_option('geodir_login_page'); |
|
| 137 | + $gd_page_id = get_option('geodir_login_page'); |
|
| 138 | 138 | |
| 139 | - if (function_exists('icl_object_id')) { |
|
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | - } |
|
| 139 | + if (function_exists('icl_object_id')) { |
|
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 144 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 145 | - } |
|
| 143 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 144 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | 147 | if (defined('ICL_LANGUAGE_CODE')){ |
| 148 | 148 | $home_url = icl_get_home_url(); |
@@ -150,35 +150,35 @@ discard block |
||
| 150 | 150 | $home_url = home_url(); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 154 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - if($gd_page_id){ |
|
| 158 | - $post = get_post($gd_page_id); |
|
| 159 | - $slug = $post->post_name; |
|
| 160 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 161 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
| 162 | - }else{ |
|
| 163 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - if($args){ |
|
| 167 | - $login_url = add_query_arg($args,$login_url ); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Filter the GeoDirectory login page url. |
|
| 172 | - * |
|
| 173 | - * This filter can be used to change the GeoDirectory page url. |
|
| 174 | - * |
|
| 175 | - * @since 1.5.3 |
|
| 176 | - * @package GeoDirectory |
|
| 177 | - * @param string $login_url The url of the login page. |
|
| 178 | - * @param array $args The array of query args used. |
|
| 179 | - * @param int $gd_page_id The page id of the GD login page. |
|
| 180 | - */ |
|
| 181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 153 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 154 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + if($gd_page_id){ |
|
| 158 | + $post = get_post($gd_page_id); |
|
| 159 | + $slug = $post->post_name; |
|
| 160 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 161 | + $login_url = trailingslashit($home_url)."$slug/"; |
|
| 162 | + }else{ |
|
| 163 | + $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if($args){ |
|
| 167 | + $login_url = add_query_arg($args,$login_url ); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Filter the GeoDirectory login page url. |
|
| 172 | + * |
|
| 173 | + * This filter can be used to change the GeoDirectory page url. |
|
| 174 | + * |
|
| 175 | + * @since 1.5.3 |
|
| 176 | + * @package GeoDirectory |
|
| 177 | + * @param string $login_url The url of the login page. |
|
| 178 | + * @param array $args The array of query args used. |
|
| 179 | + * @param int $gd_page_id The page id of the GD login page. |
|
| 180 | + */ |
|
| 181 | + return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -190,15 +190,15 @@ discard block |
||
| 190 | 190 | * @return string Info page url. |
| 191 | 191 | */ |
| 192 | 192 | function geodir_info_url($args=array()){ |
| 193 | - $gd_page_id = get_option('geodir_info_page'); |
|
| 193 | + $gd_page_id = get_option('geodir_info_page'); |
|
| 194 | 194 | |
| 195 | - if (function_exists('icl_object_id')) { |
|
| 196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 197 | - } |
|
| 195 | + if (function_exists('icl_object_id')) { |
|
| 196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 200 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 201 | - } |
|
| 199 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 200 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | 203 | if (defined('ICL_LANGUAGE_CODE')){ |
| 204 | 204 | $home_url = icl_get_home_url(); |
@@ -206,24 +206,24 @@ discard block |
||
| 206 | 206 | $home_url = home_url(); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 210 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 211 | - } |
|
| 209 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 210 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | - if($gd_page_id){ |
|
| 214 | - $post = get_post($gd_page_id); |
|
| 215 | - $slug = $post->post_name; |
|
| 216 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 217 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
| 218 | - }else{ |
|
| 219 | - $info_url = trailingslashit($home_url); |
|
| 220 | - } |
|
| 213 | + if($gd_page_id){ |
|
| 214 | + $post = get_post($gd_page_id); |
|
| 215 | + $slug = $post->post_name; |
|
| 216 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 217 | + $info_url = trailingslashit($home_url)."$slug/"; |
|
| 218 | + }else{ |
|
| 219 | + $info_url = trailingslashit($home_url); |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - if($args){ |
|
| 223 | - $info_url = add_query_arg($args,$info_url ); |
|
| 224 | - } |
|
| 222 | + if($args){ |
|
| 223 | + $info_url = add_query_arg($args,$info_url ); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - return $info_url; |
|
| 226 | + return $info_url; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | * @return string Returns converted string. |
| 240 | 240 | */ |
| 241 | 241 | function geodir_ucwords($string, $charset='UTF-8') { |
| 242 | - if (function_exists('mb_convert_case')) { |
|
| 243 | - return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
| 244 | - } else { |
|
| 245 | - return ucwords($string); |
|
| 246 | - } |
|
| 242 | + if (function_exists('mb_convert_case')) { |
|
| 243 | + return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
| 244 | + } else { |
|
| 245 | + return ucwords($string); |
|
| 246 | + } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | * @return string Returns converted string. |
| 260 | 260 | */ |
| 261 | 261 | function geodir_strtolower($string, $charset='UTF-8') { |
| 262 | - if (function_exists('mb_convert_case')) { |
|
| 263 | - return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
| 264 | - } else { |
|
| 265 | - return strtolower($string); |
|
| 266 | - } |
|
| 262 | + if (function_exists('mb_convert_case')) { |
|
| 263 | + return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
| 264 | + } else { |
|
| 265 | + return strtolower($string); |
|
| 266 | + } |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | * @return string Returns converted string. |
| 280 | 280 | */ |
| 281 | 281 | function geodir_strtoupper($string, $charset='UTF-8') { |
| 282 | - if (function_exists('mb_convert_case')) { |
|
| 283 | - return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
| 284 | - } else { |
|
| 285 | - return strtoupper($string); |
|
| 286 | - } |
|
| 282 | + if (function_exists('mb_convert_case')) { |
|
| 283 | + return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
| 284 | + } else { |
|
| 285 | + return strtoupper($string); |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | * @package GeoDirectory |
| 463 | 463 | */ |
| 464 | 464 | function _gd_die_handler() { |
| 465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 466 | - return '_gd_die_handler'; |
|
| 467 | - } else { |
|
| 468 | - die(); |
|
| 469 | - } |
|
| 465 | + if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 466 | + return '_gd_die_handler'; |
|
| 467 | + } else { |
|
| 468 | + die(); |
|
| 469 | + } |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | * @param int $status Optional. Status code. |
| 482 | 482 | */ |
| 483 | 483 | function gd_die( $message = '', $title = '', $status = 400 ) { |
| 484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
| 484 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 485 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 486 | + wp_die( $message, $title, array( 'response' => $status )); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /* |
@@ -652,37 +652,37 @@ discard block |
||
| 652 | 652 | * @return string The formatted date. |
| 653 | 653 | */ |
| 654 | 654 | function geodir_date($date_input, $date_to, $date_from = '') { |
| 655 | - if (empty($date_input) || empty($date_to)) { |
|
| 656 | - return NULL; |
|
| 657 | - } |
|
| 655 | + if (empty($date_input) || empty($date_to)) { |
|
| 656 | + return NULL; |
|
| 657 | + } |
|
| 658 | 658 | |
| 659 | - $date = ''; |
|
| 660 | - if (!empty($date_from)) { |
|
| 661 | - $datetime = date_create_from_format($date_from, $date_input); |
|
| 659 | + $date = ''; |
|
| 660 | + if (!empty($date_from)) { |
|
| 661 | + $datetime = date_create_from_format($date_from, $date_input); |
|
| 662 | 662 | |
| 663 | - if (!empty($datetime)) { |
|
| 664 | - $date = $datetime->format($date_to); |
|
| 665 | - } |
|
| 666 | - } |
|
| 663 | + if (!empty($datetime)) { |
|
| 664 | + $date = $datetime->format($date_to); |
|
| 665 | + } |
|
| 666 | + } |
|
| 667 | 667 | |
| 668 | - if (empty($date)) { |
|
| 669 | - $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
| 670 | - $date = date_i18n($date_to, strtotime($date)); |
|
| 671 | - } |
|
| 668 | + if (empty($date)) { |
|
| 669 | + $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
| 670 | + $date = date_i18n($date_to, strtotime($date)); |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | - $date = geodir_maybe_untranslate_date($date); |
|
| 674 | - /** |
|
| 675 | - * Filter the the date format conversion. |
|
| 676 | - * |
|
| 677 | - * @since 1.6.7 |
|
| 678 | - * @package GeoDirectory |
|
| 679 | - * |
|
| 680 | - * @param string $date The date string. |
|
| 681 | - * @param string $date_input The date input. |
|
| 682 | - * @param string $date_to The destination date format. |
|
| 683 | - * @param string $date_from The source date format. |
|
| 684 | - */ |
|
| 685 | - return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
| 673 | + $date = geodir_maybe_untranslate_date($date); |
|
| 674 | + /** |
|
| 675 | + * Filter the the date format conversion. |
|
| 676 | + * |
|
| 677 | + * @since 1.6.7 |
|
| 678 | + * @package GeoDirectory |
|
| 679 | + * |
|
| 680 | + * @param string $date The date string. |
|
| 681 | + * @param string $date_input The date input. |
|
| 682 | + * @param string $date_to The destination date format. |
|
| 683 | + * @param string $date_from The source date format. |
|
| 684 | + */ |
|
| 685 | + return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | /** |
@@ -707,91 +707,91 @@ discard block |
||
| 707 | 707 | * @return string Trimmed string. |
| 708 | 708 | */ |
| 709 | 709 | function geodir_excerpt($text, $length = 100, array $options = []) { |
| 710 | - if (!(int)$length > 0) { |
|
| 711 | - return $text; |
|
| 712 | - } |
|
| 713 | - $default = [ |
|
| 714 | - 'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false, |
|
| 715 | - ]; |
|
| 716 | - if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
| 717 | - $default['ellipsis'] = ""; |
|
| 718 | - } |
|
| 719 | - $options += $default; |
|
| 720 | - |
|
| 721 | - $prefix = ''; |
|
| 722 | - $suffix = $options['ellipsis']; |
|
| 723 | - |
|
| 724 | - if ($options['html']) { |
|
| 725 | - $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options); |
|
| 726 | - |
|
| 727 | - $truncateLength = 0; |
|
| 728 | - $totalLength = 0; |
|
| 729 | - $openTags = []; |
|
| 730 | - $truncate = ''; |
|
| 731 | - |
|
| 732 | - preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
|
| 733 | - foreach ($tags as $tag) { |
|
| 734 | - $contentLength = geodir_strlen($tag[3], $options); |
|
| 735 | - |
|
| 736 | - if ($truncate === '') { |
|
| 737 | - if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
| 738 | - if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
|
| 739 | - array_unshift($openTags, $tag[2]); |
|
| 740 | - } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
|
| 741 | - $pos = array_search($closeTag[1], $openTags); |
|
| 742 | - if ($pos !== false) { |
|
| 743 | - array_splice($openTags, $pos, 1); |
|
| 744 | - } |
|
| 745 | - } |
|
| 746 | - } |
|
| 747 | - |
|
| 748 | - $prefix .= $tag[1]; |
|
| 749 | - |
|
| 750 | - if ($totalLength + $contentLength + $ellipsisLength > $length) { |
|
| 751 | - $truncate = $tag[3]; |
|
| 752 | - $truncateLength = $length - $totalLength; |
|
| 753 | - } else { |
|
| 754 | - $prefix .= $tag[3]; |
|
| 755 | - } |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - $totalLength += $contentLength; |
|
| 759 | - if ($totalLength > $length) { |
|
| 760 | - break; |
|
| 761 | - } |
|
| 762 | - } |
|
| 763 | - |
|
| 764 | - if ($totalLength <= $length) { |
|
| 765 | - return $text; |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - $text = $truncate; |
|
| 769 | - $length = $truncateLength; |
|
| 770 | - |
|
| 771 | - foreach ($openTags as $tag) { |
|
| 772 | - $suffix .= '</' . $tag . '>'; |
|
| 773 | - } |
|
| 774 | - } else { |
|
| 775 | - if (geodir_strlen($text, $options) <= $length) { |
|
| 776 | - return $text; |
|
| 777 | - } |
|
| 778 | - $ellipsisLength = geodir_strlen($options['ellipsis'], $options); |
|
| 779 | - } |
|
| 780 | - |
|
| 781 | - $result = geodir_substr($text, 0, $length - $ellipsisLength, $options); |
|
| 782 | - |
|
| 783 | - if (!$options['exact']) { |
|
| 784 | - if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
|
| 785 | - $result = geodir_remove_last_word($result); |
|
| 786 | - } |
|
| 787 | - |
|
| 788 | - // Do not need to count ellipsis in the cut, if result is empty. |
|
| 789 | - if (!strlen($result)) { |
|
| 790 | - $result = geodir_substr($text, 0, $length, $options); |
|
| 791 | - } |
|
| 792 | - } |
|
| 793 | - |
|
| 794 | - return $prefix . $result . $suffix; |
|
| 710 | + if (!(int)$length > 0) { |
|
| 711 | + return $text; |
|
| 712 | + } |
|
| 713 | + $default = [ |
|
| 714 | + 'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false, |
|
| 715 | + ]; |
|
| 716 | + if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
| 717 | + $default['ellipsis'] = ""; |
|
| 718 | + } |
|
| 719 | + $options += $default; |
|
| 720 | + |
|
| 721 | + $prefix = ''; |
|
| 722 | + $suffix = $options['ellipsis']; |
|
| 723 | + |
|
| 724 | + if ($options['html']) { |
|
| 725 | + $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options); |
|
| 726 | + |
|
| 727 | + $truncateLength = 0; |
|
| 728 | + $totalLength = 0; |
|
| 729 | + $openTags = []; |
|
| 730 | + $truncate = ''; |
|
| 731 | + |
|
| 732 | + preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
|
| 733 | + foreach ($tags as $tag) { |
|
| 734 | + $contentLength = geodir_strlen($tag[3], $options); |
|
| 735 | + |
|
| 736 | + if ($truncate === '') { |
|
| 737 | + if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
| 738 | + if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
|
| 739 | + array_unshift($openTags, $tag[2]); |
|
| 740 | + } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
|
| 741 | + $pos = array_search($closeTag[1], $openTags); |
|
| 742 | + if ($pos !== false) { |
|
| 743 | + array_splice($openTags, $pos, 1); |
|
| 744 | + } |
|
| 745 | + } |
|
| 746 | + } |
|
| 747 | + |
|
| 748 | + $prefix .= $tag[1]; |
|
| 749 | + |
|
| 750 | + if ($totalLength + $contentLength + $ellipsisLength > $length) { |
|
| 751 | + $truncate = $tag[3]; |
|
| 752 | + $truncateLength = $length - $totalLength; |
|
| 753 | + } else { |
|
| 754 | + $prefix .= $tag[3]; |
|
| 755 | + } |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + $totalLength += $contentLength; |
|
| 759 | + if ($totalLength > $length) { |
|
| 760 | + break; |
|
| 761 | + } |
|
| 762 | + } |
|
| 763 | + |
|
| 764 | + if ($totalLength <= $length) { |
|
| 765 | + return $text; |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + $text = $truncate; |
|
| 769 | + $length = $truncateLength; |
|
| 770 | + |
|
| 771 | + foreach ($openTags as $tag) { |
|
| 772 | + $suffix .= '</' . $tag . '>'; |
|
| 773 | + } |
|
| 774 | + } else { |
|
| 775 | + if (geodir_strlen($text, $options) <= $length) { |
|
| 776 | + return $text; |
|
| 777 | + } |
|
| 778 | + $ellipsisLength = geodir_strlen($options['ellipsis'], $options); |
|
| 779 | + } |
|
| 780 | + |
|
| 781 | + $result = geodir_substr($text, 0, $length - $ellipsisLength, $options); |
|
| 782 | + |
|
| 783 | + if (!$options['exact']) { |
|
| 784 | + if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
|
| 785 | + $result = geodir_remove_last_word($result); |
|
| 786 | + } |
|
| 787 | + |
|
| 788 | + // Do not need to count ellipsis in the cut, if result is empty. |
|
| 789 | + if (!strlen($result)) { |
|
| 790 | + $result = geodir_substr($text, 0, $length, $options); |
|
| 791 | + } |
|
| 792 | + } |
|
| 793 | + |
|
| 794 | + return $prefix . $result . $suffix; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -815,28 +815,28 @@ discard block |
||
| 815 | 815 | * @return int |
| 816 | 816 | */ |
| 817 | 817 | function geodir_strlen($text, array $options) { |
| 818 | - if (empty($options['trimWidth'])) { |
|
| 819 | - $strlen = 'mb_strlen'; |
|
| 820 | - } else { |
|
| 821 | - $strlen = 'mb_strwidth'; |
|
| 822 | - } |
|
| 823 | - |
|
| 824 | - if (empty($options['html'])) { |
|
| 825 | - return $strlen($text); |
|
| 826 | - } |
|
| 827 | - |
|
| 828 | - $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
|
| 829 | - $replace = preg_replace_callback( |
|
| 830 | - $pattern, |
|
| 831 | - function ($match) use ($strlen) { |
|
| 832 | - $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
| 833 | - |
|
| 834 | - return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
|
| 835 | - }, |
|
| 836 | - $text |
|
| 837 | - ); |
|
| 838 | - |
|
| 839 | - return $strlen($replace); |
|
| 818 | + if (empty($options['trimWidth'])) { |
|
| 819 | + $strlen = 'mb_strlen'; |
|
| 820 | + } else { |
|
| 821 | + $strlen = 'mb_strwidth'; |
|
| 822 | + } |
|
| 823 | + |
|
| 824 | + if (empty($options['html'])) { |
|
| 825 | + return $strlen($text); |
|
| 826 | + } |
|
| 827 | + |
|
| 828 | + $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
|
| 829 | + $replace = preg_replace_callback( |
|
| 830 | + $pattern, |
|
| 831 | + function ($match) use ($strlen) { |
|
| 832 | + $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
| 833 | + |
|
| 834 | + return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
|
| 835 | + }, |
|
| 836 | + $text |
|
| 837 | + ); |
|
| 838 | + |
|
| 839 | + return $strlen($replace); |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | /** |
@@ -857,80 +857,80 @@ discard block |
||
| 857 | 857 | * @return string |
| 858 | 858 | */ |
| 859 | 859 | function geodir_substr($text, $start, $length, array $options) { |
| 860 | - if (empty($options['trimWidth'])) { |
|
| 861 | - $substr = 'mb_substr'; |
|
| 862 | - } else { |
|
| 863 | - $substr = 'mb_strimwidth'; |
|
| 864 | - } |
|
| 865 | - |
|
| 866 | - $maxPosition = geodir_strlen($text, ['trimWidth' => false] + $options); |
|
| 867 | - if ($start < 0) { |
|
| 868 | - $start += $maxPosition; |
|
| 869 | - if ($start < 0) { |
|
| 870 | - $start = 0; |
|
| 871 | - } |
|
| 872 | - } |
|
| 873 | - if ($start >= $maxPosition) { |
|
| 874 | - return ''; |
|
| 875 | - } |
|
| 876 | - |
|
| 877 | - if ($length === null) { |
|
| 878 | - $length = geodir_strlen($text, $options); |
|
| 879 | - } |
|
| 880 | - |
|
| 881 | - if ($length < 0) { |
|
| 882 | - $text = geodir_substr($text, $start, null, $options); |
|
| 883 | - $start = 0; |
|
| 884 | - $length += geodir_strlen($text, $options); |
|
| 885 | - } |
|
| 886 | - |
|
| 887 | - if ($length <= 0) { |
|
| 888 | - return ''; |
|
| 889 | - } |
|
| 890 | - |
|
| 891 | - if (empty($options['html'])) { |
|
| 892 | - return (string)$substr($text, $start, $length); |
|
| 893 | - } |
|
| 894 | - |
|
| 895 | - $totalOffset = 0; |
|
| 896 | - $totalLength = 0; |
|
| 897 | - $result = ''; |
|
| 898 | - |
|
| 899 | - $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
|
| 900 | - $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 901 | - foreach ($parts as $part) { |
|
| 902 | - $offset = 0; |
|
| 903 | - |
|
| 904 | - if ($totalOffset < $start) { |
|
| 905 | - $len = geodir_strlen($part, ['trimWidth' => false] + $options); |
|
| 906 | - if ($totalOffset + $len <= $start) { |
|
| 907 | - $totalOffset += $len; |
|
| 908 | - continue; |
|
| 909 | - } |
|
| 910 | - |
|
| 911 | - $offset = $start - $totalOffset; |
|
| 912 | - $totalOffset = $start; |
|
| 913 | - } |
|
| 914 | - |
|
| 915 | - $len = geodir_strlen($part, $options); |
|
| 916 | - if ($offset !== 0 || $totalLength + $len > $length) { |
|
| 917 | - if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 918 | - // Entities cannot be passed substr. |
|
| 919 | - continue; |
|
| 920 | - } |
|
| 921 | - |
|
| 922 | - $part = $substr($part, $offset, $length - $totalLength); |
|
| 923 | - $len = geodir_strlen($part, $options); |
|
| 924 | - } |
|
| 925 | - |
|
| 926 | - $result .= $part; |
|
| 927 | - $totalLength += $len; |
|
| 928 | - if ($totalLength >= $length) { |
|
| 929 | - break; |
|
| 930 | - } |
|
| 931 | - } |
|
| 932 | - |
|
| 933 | - return $result; |
|
| 860 | + if (empty($options['trimWidth'])) { |
|
| 861 | + $substr = 'mb_substr'; |
|
| 862 | + } else { |
|
| 863 | + $substr = 'mb_strimwidth'; |
|
| 864 | + } |
|
| 865 | + |
|
| 866 | + $maxPosition = geodir_strlen($text, ['trimWidth' => false] + $options); |
|
| 867 | + if ($start < 0) { |
|
| 868 | + $start += $maxPosition; |
|
| 869 | + if ($start < 0) { |
|
| 870 | + $start = 0; |
|
| 871 | + } |
|
| 872 | + } |
|
| 873 | + if ($start >= $maxPosition) { |
|
| 874 | + return ''; |
|
| 875 | + } |
|
| 876 | + |
|
| 877 | + if ($length === null) { |
|
| 878 | + $length = geodir_strlen($text, $options); |
|
| 879 | + } |
|
| 880 | + |
|
| 881 | + if ($length < 0) { |
|
| 882 | + $text = geodir_substr($text, $start, null, $options); |
|
| 883 | + $start = 0; |
|
| 884 | + $length += geodir_strlen($text, $options); |
|
| 885 | + } |
|
| 886 | + |
|
| 887 | + if ($length <= 0) { |
|
| 888 | + return ''; |
|
| 889 | + } |
|
| 890 | + |
|
| 891 | + if (empty($options['html'])) { |
|
| 892 | + return (string)$substr($text, $start, $length); |
|
| 893 | + } |
|
| 894 | + |
|
| 895 | + $totalOffset = 0; |
|
| 896 | + $totalLength = 0; |
|
| 897 | + $result = ''; |
|
| 898 | + |
|
| 899 | + $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
|
| 900 | + $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 901 | + foreach ($parts as $part) { |
|
| 902 | + $offset = 0; |
|
| 903 | + |
|
| 904 | + if ($totalOffset < $start) { |
|
| 905 | + $len = geodir_strlen($part, ['trimWidth' => false] + $options); |
|
| 906 | + if ($totalOffset + $len <= $start) { |
|
| 907 | + $totalOffset += $len; |
|
| 908 | + continue; |
|
| 909 | + } |
|
| 910 | + |
|
| 911 | + $offset = $start - $totalOffset; |
|
| 912 | + $totalOffset = $start; |
|
| 913 | + } |
|
| 914 | + |
|
| 915 | + $len = geodir_strlen($part, $options); |
|
| 916 | + if ($offset !== 0 || $totalLength + $len > $length) { |
|
| 917 | + if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 918 | + // Entities cannot be passed substr. |
|
| 919 | + continue; |
|
| 920 | + } |
|
| 921 | + |
|
| 922 | + $part = $substr($part, $offset, $length - $totalLength); |
|
| 923 | + $len = geodir_strlen($part, $options); |
|
| 924 | + } |
|
| 925 | + |
|
| 926 | + $result .= $part; |
|
| 927 | + $totalLength += $len; |
|
| 928 | + if ($totalLength >= $length) { |
|
| 929 | + break; |
|
| 930 | + } |
|
| 931 | + } |
|
| 932 | + |
|
| 933 | + return $result; |
|
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | /** |
@@ -943,19 +943,19 @@ discard block |
||
| 943 | 943 | * @return string |
| 944 | 944 | */ |
| 945 | 945 | function geodir_remove_last_word($text) { |
| 946 | - $spacepos = mb_strrpos($text, ' '); |
|
| 946 | + $spacepos = mb_strrpos($text, ' '); |
|
| 947 | 947 | |
| 948 | - if ($spacepos !== false) { |
|
| 949 | - $lastWord = mb_strrpos($text, $spacepos); |
|
| 948 | + if ($spacepos !== false) { |
|
| 949 | + $lastWord = mb_strrpos($text, $spacepos); |
|
| 950 | 950 | |
| 951 | - // Some languages are written without word separation. |
|
| 952 | - // We recognize a string as a word if it does not contain any full-width characters. |
|
| 953 | - if (mb_strwidth($lastWord) === mb_strlen($lastWord)) { |
|
| 954 | - $text = mb_substr($text, 0, $spacepos); |
|
| 955 | - } |
|
| 951 | + // Some languages are written without word separation. |
|
| 952 | + // We recognize a string as a word if it does not contain any full-width characters. |
|
| 953 | + if (mb_strwidth($lastWord) === mb_strlen($lastWord)) { |
|
| 954 | + $text = mb_substr($text, 0, $spacepos); |
|
| 955 | + } |
|
| 956 | 956 | |
| 957 | - return $text; |
|
| 958 | - } |
|
| 957 | + return $text; |
|
| 958 | + } |
|
| 959 | 959 | |
| 960 | - return ''; |
|
| 960 | + return ''; |
|
| 961 | 961 | } |
| 962 | 962 | \ No newline at end of file |