Skip to content

Commit

Permalink
2.0.0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
stiofan committed Sep 6, 2018
1 parent 0530526 commit f32ec27
Show file tree
Hide file tree
Showing 16 changed files with 431 additions and 354 deletions.
4 changes: 2 additions & 2 deletions assets/css/gd_core_frontend.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/gd_core_frontend.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/map.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/map.css.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion assets/css/map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,6 @@ div.geodir_map_container.geodir-map-iphone .map_background .triggermap {
.gd-map-osm .advmap_nofound {
height: inherit;
z-index: 9999;
bottom: inherit;
}
.gd-osm-gmaps .geodir_map_container .map_background span.triggermap {
top: 0!important;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/style.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ ul.geodir-tabs-content li {
}

ul.geodir-tabs-content li h3 {
margin: 0px;
// margin: 0px;
}


Expand Down
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Function to remove category parent slug could partially remove other url parts -
OSM cant handel geocode search of UK post codes missing the space - FIXED
Column looses the value after converting ENUM to TINYINT data type on upgrade - FIXED
404 rescue function added to try and automatically redirect GD 404s to their new permalink url - ADDED
Details page url can use wrong locations or category in url without showing a 404 - FIXED

v2.0.0.26
GD > Listings widget can somtimes add "View All" links to other widgets - FIXED
Expand Down
4 changes: 2 additions & 2 deletions geodirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: GeoDirectory
* Plugin URI: https://wpgeodirectory.com/
* Description: GeoDirectory plugin for WordPress.
* Version: 2.0.0.26
* Version: 2.0.0.27
* Author: AyeCode Ltd
* Author URI: https://wpgeodirectory.com
* Text Domain: geodirectory
Expand Down Expand Up @@ -60,7 +60,7 @@ final class GeoDirectory {
*
* @var string
*/
public $version = '2.0.0.26';
public $version = '2.0.0.27';

/**
* GeoDirectory instance.
Expand Down
6 changes: 3 additions & 3 deletions includes/class-geodir-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,15 @@ public static function list_comments_callback( $comment, $args, $depth ) {
<!-- .comment-content -->

<div class="comment-links">
<?php edit_comment_link( __( 'Edit', 'geodirectory' ), '<p class="edit-link">', '</p>' ); ?>
<div class="reply">
<?php edit_comment_link( __( 'Edit', 'geodirectory' ), '<span class="edit-link">', '</span>' ); ?>
<span class="reply">
<?php comment_reply_link( array_merge( $args, array(
'reply_text' => __( 'Reply', 'geodirectory' ),
'after' => ' <span>&darr;</span>',
'depth' => $depth,
'max_depth' => $args['max_depth']
) ) ); ?>
</div>
</span>
</div>

<!-- .reply -->
Expand Down
53 changes: 53 additions & 0 deletions includes/class-geodir-permalinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public function __construct() {
// make child cat not contain parent cat url
add_filter('term_link', array($this,'term_url_no_parent'), 9, 3);

// maybe make the details page 404 if the locations vars are wrong
add_action('wp',array($this,'maybe_404'));

// try and recover from 404 if GD CPT detected
add_action('wp',array($this,'_404_rescue'));

Expand All @@ -56,6 +59,56 @@ public function __construct() {
// add_action('init', array( $this, 'temp_check_rules'),10000000000);
}

public function maybe_404(){
if(geodir_is_page('single')){
global $wp_query,$gd_post,$geodirectory;

$should_404 = false;
$post_type = isset($wp_query->query_vars['post_type']) ? $wp_query->query_vars['post_type'] : '';
$post_locations = $geodirectory->location->get_post_location($gd_post);

// check country
if(isset($wp_query->query_vars['country']) && isset($gd_post->country) && $wp_query->query_vars['country']){
if(isset($post_locations->country_slug) && $post_locations->country_slug!=$wp_query->query_vars['country']){
$should_404 = true;
}
}

// check region
if(!$should_404 && isset($wp_query->query_vars['region']) && isset($gd_post->region) && $wp_query->query_vars['region']){
if(isset($post_locations->region_slug) && $post_locations->region_slug!=$wp_query->query_vars['region']){
$should_404 = true;
}
}

// check city
if(!$should_404 && isset($wp_query->query_vars['city']) && isset($gd_post->city) && $wp_query->query_vars['city']){
if(isset($post_locations->city_slug) && $post_locations->city_slug!=$wp_query->query_vars['city']){
$should_404 = true;
}
}

// check category
if(!$should_404 && isset($wp_query->query_vars[$post_type."category"]) && $wp_query->query_vars[$post_type."category"] && isset($gd_post->default_category) && $gd_post->default_category){

$is_cat = get_term_by( 'slug', $wp_query->query_vars[$post_type."category"], $post_type."category");
// print_r($is_cat);echo $wp_query->query_vars[$post_type."category"].'####';exit;

if(!$is_cat || ( isset($is_cat->term_id) && $is_cat->term_id!=$gd_post->default_category)){
$should_404 = true;
}
}



if($should_404){
$wp_query->set_404();
status_header(404);
}
}

}

/**
* Check the 404 page to see if its a GD CPT and if we can find the correct page.
*
Expand Down
Binary file modified languages/geodirectory-en_US.mo
Binary file not shown.
Loading

0 comments on commit f32ec27

Please sign in to comment.