@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | if (!empty($args['labels'])) { |
72 | 72 | foreach ($args['labels'] as $key => $val) { |
73 | - $args['labels'][$key] = __($val, 'geodirectory');// allow translation |
|
73 | + $args['labels'][$key] = __($val, 'geodirectory'); // allow translation |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | if (array_key_exists('rewrite', $args)) { |
113 | 113 | if (array_key_exists('slug', $args['rewrite'])) |
114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
114 | + $args['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $geodir_post_types = get_option('geodir_post_types'); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | if (array_key_exists('rewrite', $geodir_post_types[$post_type])) |
125 | 125 | if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite'])) |
126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
126 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%'; |
|
127 | 127 | |
128 | 128 | update_option('geodir_post_types', $geodir_post_types); |
129 | 129 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | |
136 | 136 | $geodir_taxonomies = get_option('geodir_taxonomies'); |
137 | 137 | |
138 | - if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) { |
|
139 | - $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; |
|
138 | + if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type.'category'])) { |
|
139 | + $geodir_taxonomies[$post_type.'category']['listing_slug'] = $listing_slug; |
|
140 | 140 | |
141 | - if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) |
|
142 | - if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args'])) |
|
143 | - if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite'])) |
|
144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
141 | + if (array_key_exists('args', $geodir_taxonomies[$post_type.'category'])) |
|
142 | + if (array_key_exists('rewrite', $geodir_taxonomies[$post_type.'category']['args'])) |
|
143 | + if (array_key_exists('slug', $geodir_taxonomies[$post_type.'category']['args']['rewrite'])) |
|
144 | + $geodir_taxonomies[$post_type.'category']['args']['rewrite']['slug'] = $listing_slug; |
|
145 | 145 | |
146 | 146 | update_option('geodir_taxonomies', $geodir_taxonomies); |
147 | 147 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | |
150 | 150 | /* --- update taxonomies (tags) --- */ |
151 | 151 | $geodir_taxonomies_tag = get_option('geodir_taxonomies'); |
152 | - if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) { |
|
153 | - $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; |
|
152 | + if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type.'_tags'])) { |
|
153 | + $geodir_taxonomies_tag[$post_type.'_tags']['listing_slug'] = $listing_slug.'/tags'; |
|
154 | 154 | |
155 | - if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) |
|
156 | - if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args'])) |
|
157 | - if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite'])) |
|
158 | - $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
155 | + if (array_key_exists('args', $geodir_taxonomies_tag[$post_type.'_tags'])) |
|
156 | + if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type.'_tags']['args'])) |
|
157 | + if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type.'_tags']['args']['rewrite'])) |
|
158 | + $geodir_taxonomies_tag[$post_type.'_tags']['args']['rewrite']['slug'] = $listing_slug.'/tags'; |
|
159 | 159 | |
160 | 160 | update_option('geodir_taxonomies', $geodir_taxonomies_tag); |
161 | 161 | |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | $listing_slug = $args['listing_slug']; |
206 | 206 | |
207 | 207 | if (strpos($taxonomy, 'tags')) { |
208 | - $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]'; |
|
209 | - $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; |
|
208 | + $newrules[$listing_slug.'/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&paged=$matches[2]'; |
|
209 | + $newrules[$listing_slug.'/(.+?)/?$'] = 'index.php?'.$taxonomy.'=$matches[1]'; |
|
210 | 210 | } else { |
211 | 211 | // use this loop to add paging for details page comments paging |
212 | - $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]'; |
|
212 | + $newrules[str_replace("/tags", "", $listing_slug).'/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&cpage=$matches[2]'; |
|
213 | 213 | } |
214 | 214 | endforeach; |
215 | 215 | endif; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | // create rules for location listing |
218 | 218 | $location_page = get_option('geodir_location_page'); |
219 | 219 | |
220 | - if($location_page) { |
|
220 | + if ($location_page) { |
|
221 | 221 | global $wpdb; |
222 | 222 | $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page)); |
223 | 223 | } |
@@ -247,30 +247,30 @@ discard block |
||
247 | 247 | |
248 | 248 | if ($matches2) { |
249 | 249 | if ($neighbourhood_active) { |
250 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]'; |
|
250 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]'; |
|
251 | 251 | } |
252 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]'; |
|
252 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]'; |
|
253 | 253 | } else { |
254 | 254 | if ($neighbourhood_active) { |
255 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]'; |
|
255 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]'; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]'; |
|
259 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]'; |
|
260 | 260 | } else { // country/region/city |
261 | 261 | if ($neighbourhood_active) { |
262 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]'; |
|
262 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]'; |
|
263 | 263 | } |
264 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; |
|
265 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]'; |
|
266 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]'; |
|
264 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; |
|
265 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]'; |
|
266 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]'; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | if ($location_page && function_exists('icl_object_id')) { |
270 | - foreach(icl_get_languages('skip_missing=N') as $lang){ |
|
270 | + foreach (icl_get_languages('skip_missing=N') as $lang) { |
|
271 | 271 | $alt_page_id = ''; |
272 | - $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); |
|
273 | - if($alt_page_id){ |
|
272 | + $alt_page_id = icl_object_id($location_page, 'page', false, $lang['language_code']); |
|
273 | + if ($alt_page_id) { |
|
274 | 274 | $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id)); |
275 | 275 | |
276 | 276 | if ($location_manager && ($hide_country_part || $hide_region_part)) { |
@@ -289,29 +289,29 @@ discard block |
||
289 | 289 | |
290 | 290 | if ($matches2) { |
291 | 291 | if ($neighbourhood_active) { |
292 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]'; |
|
292 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]'; |
|
293 | 293 | } |
294 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]'; |
|
294 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]'; |
|
295 | 295 | } else { |
296 | 296 | if ($neighbourhood_active) { |
297 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]'; |
|
297 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]'; |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
301 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]'; |
|
301 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]'; |
|
302 | 302 | } else { // country/region/city |
303 | 303 | if ($neighbourhood_active) { |
304 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]'; |
|
304 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]'; |
|
305 | 305 | } |
306 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; |
|
307 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]'; |
|
308 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]'; |
|
306 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; |
|
307 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]'; |
|
308 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]'; |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | - $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; |
|
314 | + $newrules[$location_prefix.'/?$'] = 'index.php?page_id='.$location_page; |
|
315 | 315 | |
316 | 316 | $rules = array_merge($newrules, $rules); |
317 | 317 | return $rules; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | #Redirect 301 /location/ /$location_prefix/ |
341 | 341 | # END GeoDirectory Rules\n\n |
342 | 342 | EOD; |
343 | - return $my_content . $rules; |
|
343 | + return $my_content.$rules; |
|
344 | 344 | } |
345 | 345 | //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents'); |
346 | 346 | |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | global $wpdb; |
417 | 417 | |
418 | 418 | $page_for_posts = get_option('page_for_posts'); |
419 | - $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename'])); |
|
419 | + $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s", $wp->query_vars['pagename'])); |
|
420 | 420 | |
421 | 421 | if (function_exists('icl_object_id')) { |
422 | 422 | $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); |
423 | 423 | } |
424 | - if ($real_page_id && $real_page_id!=$page_for_posts) { |
|
424 | + if ($real_page_id && $real_page_id != $page_for_posts) { |
|
425 | 425 | $wp->query_vars['page_id'] = $real_page_id; |
426 | 426 | } |
427 | 427 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $gd_city = $default_location->city_slug; |
470 | 470 | |
471 | 471 | $base_location_link = geodir_get_location_link('base'); |
472 | - wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); |
|
472 | + wp_redirect($base_location_link.'/'.$gd_country.'/'.$gd_region.'/'.$gd_city); |
|
473 | 473 | exit(); |
474 | 474 | } |
475 | 475 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $geodir_set_location_session = true; |
531 | 531 | $geodir_taxonomis = geodir_get_taxonomies('', true); |
532 | 532 | |
533 | - if(!empty($geodir_taxonomis)){ |
|
533 | + if (!empty($geodir_taxonomis)) { |
|
534 | 534 | foreach ($geodir_taxonomis as $taxonomy) { |
535 | 535 | if (array_key_exists($taxonomy, $wp->query_vars)) { |
536 | 536 | $is_geodir_taxonomy = true; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | |
590 | - $geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count); |
|
590 | + $geodir_term = str_replace('/'.$geodir_last_term, '', $geodir_term, $post_title_replace_count); |
|
591 | 591 | if (!$post_title_replace_count) |
592 | 592 | $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count); |
593 | 593 | $geodir_terms = explode('/', $geodir_term); |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
665 | 665 | $is_geodir_location_found = true; |
666 | 666 | } |
667 | - } else if ($geodir_show_location_url == 'region_city') { |
|
667 | + } else if ($geodir_show_location_url == 'region_city') { |
|
668 | 668 | if (count($geodir_terms) >= 2) { |
669 | 669 | $gd_region = urldecode($geodir_terms[0]); |
670 | 670 | $gd_city = urldecode($geodir_terms[1]); |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | $wp->query_vars[$geodir_taxonomy] = $geodir_term; |
724 | 724 | // eliminate location related terms from taxonomy term |
725 | 725 | if ($gd_country != '') |
726 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
726 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_country).'/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
727 | 727 | |
728 | 728 | if ($gd_region != '') |
729 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
729 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_region).'/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
730 | 730 | |
731 | 731 | if ($gd_city != '') |
732 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
732 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_city).'/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
733 | 733 | |
734 | 734 | |
735 | 735 | $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]); |
@@ -914,16 +914,16 @@ discard block |
||
914 | 914 | * @param string $option Option name. |
915 | 915 | * @return mixed The taxonomy option value. |
916 | 916 | */ |
917 | -function geodir_wpseo_taxonomy_meta( $value, $option = '' ) { |
|
917 | +function geodir_wpseo_taxonomy_meta($value, $option = '') { |
|
918 | 918 | global $wp_query; |
919 | 919 | |
920 | - if ( !empty( $value ) && ( is_category() || is_tax() ) ) { |
|
920 | + if (!empty($value) && (is_category() || is_tax())) { |
|
921 | 921 | $term = $wp_query->get_queried_object(); |
922 | 922 | |
923 | - if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) { |
|
924 | - $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); |
|
923 | + if (!empty($term->term_id) && !empty($term->taxonomy) && isset($value[$term->taxonomy][$term->term_id]) && in_array(str_replace('category', '', $term->taxonomy), geodir_get_posttypes())) { |
|
924 | + $image = geodir_get_default_catimage($term->term_id, str_replace('category', '', $term->taxonomy)); |
|
925 | 925 | |
926 | - if ( !empty( $image['src'] ) ) { |
|
926 | + if (!empty($image['src'])) { |
|
927 | 927 | $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; |
928 | 928 | $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; |
929 | 929 | } |
@@ -931,4 +931,4 @@ discard block |
||
931 | 931 | } |
932 | 932 | return $value; |
933 | 933 | } |
934 | -add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 ); |
|
934 | +add_filter('option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2); |