Skip to content

Commit

Permalink
v2.0.0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
stiofan committed Oct 1, 2018
1 parent 6522470 commit 2ba6cf7
Show file tree
Hide file tree
Showing 26 changed files with 280 additions and 143 deletions.
2 changes: 1 addition & 1 deletion 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.

3 changes: 2 additions & 1 deletion assets/css/partials/_search_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ SIDEBAR STYLES
z-index: 100;
width: 100%;
overflow-y: scroll;
text-align: left;


ul{
Expand All @@ -229,7 +230,7 @@ SIDEBAR STYLES
li{
display: block;
width: 100%;
padding: 2px 10px;
padding: 0 10px;
color: #505050;
margin: 0;

Expand Down
7 changes: 7 additions & 0 deletions assets/css/partials/_widget_categories.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
display: block;
margin: auto;
margin-top: 25%;
&.attachment-thumbnail{
height: 100%;
margin-top: 0;
border-radius: 2px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
}

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.

10 changes: 10 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
v2.0.0.30
Comments count sometimes only updated on edit not initial save - FIXED
Tags sometimes not searched for - FIXED
WP_POST_REVISIONS disabled or limited can cause backend saving to fail on new post - FIXED
Category input not saving properly if radio or text input type used - FIXED
You can now use the category default image in the category widget - ADDED
Leave comment link sometimes added to GD archive pages - FIXED
Close comments on GD archive pages - CHANGED
Categories widget/shortcode now uses max_count as the main limit and mac_count_child for sub cats - CHANGED

v2.0.0.29
Custom fields order can be broken if saved-moved-saved - FIXED
Add listing shortcode using default CPT instead of selected one - 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.29
* Version: 2.0.0.30
* 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.29';
public $version = '2.0.0.30';

/**
* GeoDirectory instance.
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/class-geodir-admin-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public function admin_scripts() {
wp_register_script('geodir-leaflet-routing-script', geodir_plugin_url() . '/assets/leaflet/routing/leaflet-routing-machine'.$suffix.'.js', array(), GEODIRECTORY_VERSION);
wp_register_script('geodir-lity', geodir_plugin_url() . '/assets/js/libraries/gd_lity'.$suffix.'.js', array(), GEODIRECTORY_VERSION);
wp_register_script('geodir-nestable-script', geodir_plugin_url() . '/assets/js/libraries/jquery.nestable'.$suffix.'.js', array(), GEODIRECTORY_VERSION);
wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.1.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.1.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.3.1/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.3.1/js/v4-shims.js', array(), GEODIRECTORY_VERSION);

// this should be everywhere
wp_enqueue_script( 'font-awesome' );
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/class-geodir-admin-taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -760,13 +760,13 @@ public static function taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_emp
$child_dash = $p > 0 ? str_repeat("-", $p/20).' ' : '';

if ($cat_display == 'radio')
$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" data-cradio="default_category">' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="tax_input['.$cat_term->taxonomy .'][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" data-cradio="default_category">' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
elseif ($cat_display == 'select' || $cat_display == 'multiselect')
$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . $child_dash . geodir_utf8_ucfirst($cat_term->name) . '</option>';

else {
$class = $checked ? 'class="gd-term-checked"' : '';
$out .= '<span style="display:block" ' . $class . '><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" data-ccheckbox="default_category">' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '<span class="gd-make-default-term" style="display:none" title="' . esc_attr( wp_sprintf( __( 'Make %s default category', 'geodirectory' ), geodir_utf8_ucfirst($cat_term->name) ) ) . '">' . __( 'Make default', 'geodirectory' ). '</span><span class="gd-is-default-term" style="display:none">' . __( 'Default', 'geodirectory' ). '</span></span>';
$out .= '<span style="display:block" ' . $class . '><input style="display:inline-block" type="checkbox" field_type="checkbox" name="tax_input['.$cat_term->taxonomy .'][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" data-ccheckbox="default_category">' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '<span class="gd-make-default-term" style="display:none" title="' . esc_attr( wp_sprintf( __( 'Make %s default category', 'geodirectory' ), geodir_utf8_ucfirst($cat_term->name) ) ) . '">' . __( 'Make default', 'geodirectory' ). '</span><span class="gd-is-default-term" style="display:none">' . __( 'Default', 'geodirectory' ). '</span></span>';
}

// Call recurson to print sub cats
Expand Down
23 changes: 10 additions & 13 deletions includes/class-geodir-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,15 @@ public static function update_post_rating( $post_id = 0, $post_type = '', $delet

if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $detail_table . "'" ) == $detail_table ) {

// $wpdb->query(
// $wpdb->prepare(
// "UPDATE " . $detail_table . " SET
// overall_rating = %f,
// rating_count = %f
// where post_id = %d",
// array( $post_newrating, $post_newrating_count, $post_id )
// )
// );

update_post_meta( $post_id, 'overall_rating', $post_newrating );
update_post_meta( $post_id, 'rating_count', $post_newrating_count );
$wpdb->query(
$wpdb->prepare(
"UPDATE " . $detail_table . " SET
overall_rating = %f,
rating_count = %f
where post_id = %d",
array( $post_newrating, $post_newrating_count, $post_id )
)
);
}
/**
* Called after Updating post overall rating and rating count.
Expand Down Expand Up @@ -339,7 +336,7 @@ public static function save_rating( $comment = 0 ) {
*/
do_action( 'geodir_after_save_comment', $_REQUEST, 'Comment Your Post' );

self::update_post_rating( $post_id );
self::update_post_rating( $post_id,$gd_post->post_type );
}
}

Expand Down
2 changes: 1 addition & 1 deletion includes/class-geodir-permalinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function location_rewrite_rules(){
*/
public function search_rewrite_rules(){
// add search paging rewrite
$this->add_rewrite_rule( "^".$this->search_slug() . '/page/([^/]+)/?', 'index.php?paged=$matches[1]', 'top' );
$this->add_rewrite_rule( "^".$this->search_slug() . '/page/([^/]+)/?', 'index.php?pagename='.$this->search_slug().'&paged=$matches[1]', 'top' );
}

/**
Expand Down
8 changes: 4 additions & 4 deletions includes/class-geodir-post-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ public static function save_post( $post_id, $post, $update ) {

//echo '###';print_r($_REQUEST);print_r(self::$post_temp);print_r($post);exit;



// only fire if $post_temp is set
if ( $gd_post = self::$post_temp ) {

Expand All @@ -130,6 +128,7 @@ public static function save_post( $post_id, $post, $update ) {
} elseif ( $gd_post['post_type'] == 'revision' ) {
$gd_post['post_type'] = get_post_type( $gd_post['post_parent'] );
}

$post_type = esc_attr($gd_post['post_type']); // set the post type early

// unhook this function so it doesn't loop infinitely
Expand Down Expand Up @@ -234,7 +233,7 @@ public static function save_post( $post_id, $post, $update ) {

// Set tags

// check fro dummy data tags
// check for dummy data tags
if( empty($gd_post['post_tags']) && isset($gd_post['tax_input'][$post_type.'_tags']) && !empty($gd_post['tax_input'][$post_type.'_tags'])){

// quick edit returns tag ids, we need the strings
Expand Down Expand Up @@ -515,10 +514,11 @@ public static function save_files( $post_id = 0, $files = array(),$field = '', $
* @return array
*/
public static function wp_insert_post_data( $data, $postarr ) {

// check its a GD CPT first
if (
( isset( $data['post_type'] ) && in_array( $data['post_type'], geodir_get_posttypes() ) )
|| ( isset( $data['post_type'] ) && $data['post_type'] == 'revision' && in_array( get_post_type( $data['post_parent'] ), geodir_get_posttypes() ) )
|| ( isset( $data['post_type'] ) && $data['post_type'] == 'revision' && in_array( get_post_type( $data['post_parent'] ), geodir_get_posttypes() ) && (!isset(self::$post_temp) || empty(self::$post_temp)) )
) {
self::$post_temp = $postarr;
}
Expand Down
1 change: 0 additions & 1 deletion includes/class-geodir-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ public function posts_where($where, $query = array()){
$term_results = $wpdb->get_results( $term_sql );

$term_ids = array();
$terms_sql = '';

if ( ! empty( $term_results ) ) {
foreach ( $term_results as $term_id ) {
Expand Down
5 changes: 5 additions & 0 deletions includes/class-geodir-template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ public static function setup_singular_page($content){
*/
private static function get_template_loader_files( $default_file ) {
$search_files = apply_filters( 'geodir_template_loader_files', array(), $default_file );

if(geodir_is_page('archive') || geodir_is_page('search')){
$search_files[] = 'geodirectory-archive.php';
}

$search_files[] = 'geodirectory.php';

if ( geodir_is_taxonomy() ) {
Expand Down
4 changes: 2 additions & 2 deletions includes/comments-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ function geodir_get_post_rating( $post_id = 0, $force_query = 0 ) {
* @global object $wpdb WordPress Database object.
* @return bool|null|string
*/
function geodir_get_review_count_total( $post_id = 0 ) {
return GeoDir_Comments::get_post_review_count_total( $post_id, $force_query = 0 );
function geodir_get_review_count_total( $post_id = 0, $force_query = 0 ) {
return GeoDir_Comments::get_post_review_count_total( $post_id, $force_query );
}

/**
Expand Down
6 changes: 5 additions & 1 deletion includes/core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ function geodir_column_exist( $db, $column ) {
* @since 2.0.0
*/
function goedir_register_widgets() {

if ( get_option( 'geodirectory_version' ) ) {
register_widget( 'GeoDir_Widget_Search' );
register_widget( 'GeoDir_Widget_Best_Of' );
Expand Down Expand Up @@ -930,11 +931,14 @@ function geodir_search_form_post_type_input() {
$post_types = (array)$post_types;
if($curr_post_type && isset($post_types[$curr_post_type])){
$pt_arr = $post_types[$curr_post_type];
$pt_value = $curr_post_type;
}else{
$pt_value = key( $post_types );
$pt_arr = reset($post_types);
}

$pt_slug = isset($pt_arr->rewrite->slug) ? esc_attr($pt_arr->rewrite->slug) : 'places';
echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" data-slug="'.$pt_slug.'" />';
echo '<input type="hidden" name="stype" value="' . esc_attr( $pt_value ) . '" data-slug="'.$pt_slug.'" />';
}else{
echo '<input type="hidden" name="stype" value="gd_place" data-slug="places"/>';
}
Expand Down
4 changes: 2 additions & 2 deletions includes/custom-fields/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function geodir_post_custom_fields($package_id = '', $default = 'all', $post_typ
$pricearr = explode(',', $post_meta_info_obj->packages);

if ($package_id != '' && in_array($package_id, $pricearr)) {
$return_arr[$post_meta_info_obj->sort_order.$post_meta_info_obj->post_type] = $custom_fields;
$return_arr[$post_meta_info_obj->sort_order.$post_meta_info_obj->post_type.$post_meta_info_obj->htmlvar_name] = $custom_fields;
} elseif ($package_id == '') {
$return_arr[$post_meta_info_obj->sort_order.$post_meta_info_obj->post_type] = $custom_fields;
$return_arr[$post_meta_info_obj->sort_order.$post_meta_info_obj->post_type.$post_meta_info_obj->htmlvar_name] = $custom_fields;
}
}
}
Expand Down
51 changes: 37 additions & 14 deletions includes/general-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,20 +738,6 @@ function geodir_custom_posts_body_class( $classes ) {
$classes[] = 'geodir_custom_posts';
}

// fix body class for signup page
if ( geodir_is_page( 'login' ) ) {
$new_classes = array();
$new_classes[] = 'signup page-geodir-signup';
if ( ! empty( $classes ) ) {
foreach ( $classes as $class ) {
if ( $class && $class != 'home' && $class != 'blog' ) {
$new_classes[] = $class;
}
}
}
$classes = $new_classes;
}

if ( geodir_is_geodir_page() ) {
$classes[] = 'geodir-page';
}
Expand All @@ -760,6 +746,16 @@ function geodir_custom_posts_body_class( $classes ) {
$classes[] = 'geodir-page-search';
}

if ( geodir_is_page( 'post_type' ) || geodir_is_page( 'archive' ) || geodir_is_page( 'author' ) || geodir_is_page( 'search' ) ) {
$post_type = geodir_get_current_posttype();
$classes[] = 'geodir-archive';

if(isset($post_types->{$post_type}) && isset($post_types->{$post_type}->disable_location) && $post_types->{$post_type}->disable_location){
$classes[] = 'geodir-archive-locationless';
}
}


return $classes;
}

Expand Down Expand Up @@ -1988,4 +1984,31 @@ function geodir_cpt_template_pages() {
wp_cache_set( 'geodir_cpt_template_pages', $page_ids, 'geodir_cpt_template_page' );

return $page_ids;
}

/**
* Get CPT templage page for the CPT.
*
* @since 2.0.0.30
* @package GeoDirectory
* @return int The page id.
*/
function geodir_cpt_template_page($page,$post_type) {

$default = geodir_get_option($page);
$page_id = $default ? $default : '';
$pages = array( 'page_details', 'page_archive', 'page_archive_item' );


// bail if its not a CPT template
if(in_array($page,$pages)){

$post_types = geodir_get_posttypes( 'object' );
if(isset($post_types->{$post_type}->page_details) && $post_types->{$post_type}->page_details){
$page_id = $post_types->{$post_type}->page_details;
}
}

return $page_id;
}
4 changes: 2 additions & 2 deletions includes/taxonomy-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_emp
}

if ($cat_display == 'radio')
$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="tax_input[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
elseif ($cat_display == 'select' || $cat_display == 'multiselect')
$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';

else {
$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="tax_input[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
}

// Call recurson to print sub cats
Expand Down
Loading

0 comments on commit 2ba6cf7

Please sign in to comment.