Skip to content

Commit

Permalink
Merge pull request #1049 from kprajapatii/master
Browse files Browse the repository at this point in the history
2.0.0.75
  • Loading branch information
kprajapatii authored Jan 29, 2020
2 parents c0ff274 + 71e3d38 commit 5e3c525
Show file tree
Hide file tree
Showing 9 changed files with 563 additions and 533 deletions.
6 changes: 3 additions & 3 deletions geodirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
* Plugin Name: GeoDirectory
* Plugin URI: https://wpgeodirectory.com/
* Description: GeoDirectory plugin for WordPress.
* Version: 2.0.0.74
* Version: 2.0.0.75
* Author: AyeCode Ltd
* Author URI: https://wpgeodirectory.com
* Text Domain: geodirectory
* Domain Path: /languages
* Requires at least: 4.5
* Tested up to: 5.3.1
* Tested up to: 5.3.2
*/


Expand All @@ -35,7 +35,7 @@ final class GeoDirectory {
*
* @var string
*/
public $version = '2.0.0.74';
public $version = '2.0.0.75';

/**
* GeoDirectory instance.
Expand Down
22 changes: 11 additions & 11 deletions includes/admin/class-geodir-admin-taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public function render_cat_color( $cat_color = '', $id = 'ct_cat_color', $name =
class="gd-color-picker"
placeholder="<?php ?>"
data-default-color=""/>
<p class="description"><?php _e( 'Select the schema to use for this category', 'geodirectory' ); ?></p>
<p class="description"><?php _e( 'Select the color to use for this category', 'geodirectory' ); ?></p>
<?php
return ob_get_clean();
}
Expand Down Expand Up @@ -600,7 +600,7 @@ public function save_category_fields( $term_id, $tt_id = '', $taxonomy = '' ) {
update_term_meta( $term_id, 'ct_cat_top_desc', $_POST['ct_cat_top_desc'] );
}

// Categoty listing default image.
// Category listing default image.
if ( isset( $_POST['ct_cat_default_img'] ) ) {
$cat_default_img = $_POST['ct_cat_default_img'];

Expand All @@ -613,7 +613,7 @@ public function save_category_fields( $term_id, $tt_id = '', $taxonomy = '' ) {
update_term_meta( $term_id, 'ct_cat_default_img', $cat_default_img );
}

// Categoty icon.
// Category icon.
if ( isset( $_POST['ct_cat_icon'] ) ) {
$cat_icon = $_POST['ct_cat_icon'];

Expand Down Expand Up @@ -740,10 +740,10 @@ public function get_column( $columns, $column, $id ) {
* @param string $cat_taxonomy Category taxonomy.
* @param int $cat_parent Optional. Category parent ID. Default 0.
* @param bool $hide_empty Optional. Taxonomy hide empty. Default false.
* @param int $pading Optional. Pading value . Default 0.
* @param int $padding Optional. Padding value . Default 0.
* @return string Taxonomy walker html.
*/
public static function taxonomy_walker( $cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0 ) {
public static function taxonomy_walker( $cat_taxonomy, $cat_parent = 0, $hide_empty = false, $padding = 0 ) {
global $cat_display, $post_cat, $exclude_cats;

$search_terms = trim( $post_cat, "," );
Expand All @@ -760,8 +760,8 @@ public static function taxonomy_walker( $cat_taxonomy, $cat_parent = 0, $hide_em
//If there are terms, start displaying
if (count($cat_terms) > 0) {
//Displaying as a list
$p = $pading * 20;
$pading++;
$p = $padding * 20;
$padding++;


if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
Expand All @@ -785,8 +785,8 @@ public static function taxonomy_walker( $cat_taxonomy, $cat_parent = 0, $hide_em
$no_child = false;

if ( absint( $cat_parent ) == 0 && count( $cat_terms ) == 1 ) {
// Call recurson to print sub cats
$sub_out = self::taxonomy_walker( $cat_taxonomy, $cat_term->term_id, $hide_empty, $pading );
// Call recursion to print sub cats
$sub_out = self::taxonomy_walker( $cat_taxonomy, $cat_term->term_id, $hide_empty, $padding );

if ( trim( $sub_out ) == '' ) {
$no_child = true; // Set category selected when only one category.
Expand All @@ -813,8 +813,8 @@ public static function taxonomy_walker( $cat_taxonomy, $cat_parent = 0, $hide_em
}

if ( ! ( absint( $cat_parent ) == 0 && count( $cat_terms ) == 1 ) ) {
// Call recurson to print sub cats
$sub_out = self::taxonomy_walker( $cat_taxonomy, $cat_term->term_id, $hide_empty, $pading );
// Call recursion to print sub cats
$sub_out = self::taxonomy_walker( $cat_taxonomy, $cat_term->term_id, $hide_empty, $padding );
}

$out .= $sub_out;
Expand Down
21 changes: 10 additions & 11 deletions includes/admin/settings/class-geodir-settings-cpt-cf-extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,20 @@ public static function date_format($output,$result_str,$cf,$field_info){
* @param object $field_info Datepicker fields information.
* @return string $output.
*/
public static function date_range($output,$result_str,$cf,$field_info){
ob_start();
$extra = array();
if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
$extra = unserialize($field_info->extra_fields);
public static function date_range( $output, $result_str, $cf, $field_info ) {
$extra_fields = array();
if ( ! empty( $field_info->extra_fields ) ) {
$extra_fields = is_array( $field_info->extra_fields ) ? $field_info->extra_fields : maybe_unserialize( $field_info->extra_fields );
}

$value = '';
if (isset($field_info->extra_fields->date_range)) {
$value = esc_attr($field_info->extra_fields->date_range);
}elseif(isset($cf['defaults']['extra_fields']['date_range']) && $cf['defaults']['extra_fields']['date_range']){
$value = esc_attr($cf['defaults']['extra_fields']['date_range']);
if ( isset( $extra_fields['date_range'] ) ) {
$value = esc_attr( $extra_fields['date_range'] );
} elseif ( isset( $cf['defaults']['extra_fields']['date_range'] ) && $cf['defaults']['extra_fields']['date_range'] ) {
$value = esc_attr( $cf['defaults']['extra_fields']['date_range'] );
}

ob_start();
?>
<p data-setting="date_range">
<label for="date_range" class="dd-setting-name">
Expand All @@ -469,12 +469,11 @@ public static function date_range($output,$result_str,$cf,$field_info){
</label>
</p>
<?php

$output .= ob_get_clean();

return $output;
}


/**
* Multiple input option values.
*
Expand Down
6 changes: 3 additions & 3 deletions includes/admin/settings/class-geodir-settings-cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public function get_settings( $current_section = '' ) {
'advanced' => true,
'value' => $post_type_values['description']
),
array( 'type' => 'sectionend', 'id' => 'cpt_settings_seo' ),
array( 'type' => 'sectionend', 'id' => 'cpt_settings_description' ),

array(
'title' => __( 'SEO Overrides', 'geodirectory' ),
Expand Down Expand Up @@ -528,7 +528,7 @@ public function get_settings( $current_section = '' ) {
),

// Page template
array( 'type' => 'sectionend', 'id' => 'cpt_settings_page' ),
array( 'type' => 'sectionend', 'id' => 'cpt_settings_seo' ),

array(
'title' => __( 'Template Page Settings', 'geodirectory' ),
Expand Down Expand Up @@ -588,7 +588,7 @@ public function get_settings( $current_section = '' ) {
),


array( 'type' => 'sectionend', 'id' => 'cpt_settings_seo' ),
array( 'type' => 'sectionend', 'id' => 'cpt_settings_page' ),


) );
Expand Down
106 changes: 23 additions & 83 deletions includes/class-geodir-permalinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,107 +800,47 @@ public static function arrange_rewrite_rules( $rules ) {
$post_types = geodir_get_posttypes( 'names' );

$post_type_slugs = array();
$_post_type_slugs = array();
$taxonomy_rules_top = array();
$taxonomy_rules = array();
$pt_rules_top = array();
$pt_rules = array();

// Get post type slugs
foreach ( $rules as $regex => $query ) {
foreach ( $post_types as $post_type ) {
if ( empty( $post_type_slugs[ $post_type ] ) ) {
$post_type_slugs[ $post_type ] = array();
}

if ( strpos( $query, 'index.php?post_type=' . $post_type . '&paged=' ) === 0 ) {
$_regex = explode( '/', $regex );
$post_type_slugs[ $post_type ][] = $_regex[0];
$_post_type_slugs[] = $_regex[0];
}
if ( strpos( $query, 'index.php?post_type=' ) !== 0 ) {
continue;
}
}

$_rules = $rules;
foreach ( $rules as $_regex => $_query ) {
foreach ( $_post_type_slugs as $slug ) {
if ( isset( $_rules[ $_regex ] ) && ( strpos( $_regex, '^' . $slug . '/' ) === 0 || strpos( $_regex, $slug . '/' ) === 0 ) && ( strpos( $_query, '?attachment=' ) !== false || strpos( $_query, '&attachment=' ) !== false || strpos( $_query, '&tb=1' ) !== false || strpos( $_query, '&embed=true' ) !== false || strpos( $_query, '&geodir-api=' ) !== false ) ) {
unset( $_rules[ $_regex ] );
}
}
}
$rules = $_rules;

foreach ( $rules as $regex => $query ) {
foreach ( $post_types as $post_type ) {
if ( strpos( $query, 'index.php?' . $post_type . 'category=' ) === 0 || strpos( $query, 'index.php?' . $post_type . '_tags=' ) === 0 || strpos( $query, 'index.php?post_type=' . $post_type . '&' . $post_type . 'category=' ) === 0 || strpos( $query, 'index.php?post_type=' . $post_type . '&' . $post_type . '_tags=' ) === 0 ) {
if ( strpos( $query, '&feed=' ) !== false || strpos( $query, '&paged=' ) !== false ) {
$taxonomy_rules_top[ $regex ] = $query;
} else {
$taxonomy_rules[ $regex ] = $query;
}
unset( $_rules[ $regex ] );
} elseif ( strpos( $query, '&feed=' ) !== false || strpos( $query, '&paged=' ) !== false || strpos( $query, '&cpage=' ) !== false ) {
if ( strpos( $query, '?' . $post_type . '=' ) !== false ) {
$pt_rules_top[ $regex ] = $query;
unset( $_rules[ $regex ] );
} elseif ( ! empty( $post_type_slugs[ $post_type ] ) ) {
$pt_slugs = array_unique( $post_type_slugs[ $post_type ] );

foreach ( $pt_slugs as $slug ) {
if ( $slug && strpos( $regex, $slug . '/[' ) === 0 ) {
$pt_rules[ $regex ] = $query;
unset( $_rules[ $regex ] );
}
}
if ( strpos( $query, 'index.php?post_type=' . $post_type . '&' ) === 0 ) {
$_regex = explode( '/', $regex );
$slug = ! empty( $_regex[0] ) ? str_replace( '^', '', $_regex[0] ) : '';

if ( ! empty( $slug ) && ! in_array( $slug, $post_type_slugs ) ) {
$post_type_slugs[] = $_regex[0];
}
}
}
}

// Set links with paged, feed at top
if ( ! empty( $taxonomy_rules_top ) || ! empty( $taxonomy_rules ) || ! empty( $pt_rules_top ) || ! empty( $pt_rules ) ) {
$new_rules = array();

$rules_added = false;
foreach ( $_rules as $_regex => $_query ) {
if ( ! $rules_added ) {
foreach ( $_post_type_slugs as $slug ) {
if ( ! $rules_added && strpos( $_regex, '^' . $slug . '/(' ) === 0 ) {
$rules_added = true;

if ( ! empty( $taxonomy_rules_top ) ) {
foreach ( $taxonomy_rules_top as $regex => $query ) {
$new_rules[ $regex ] = $query;
}
}
if ( empty( $post_type_slugs ) ) {
return $rules;
}

if ( ! empty( $taxonomy_rules ) ) {
foreach ( $taxonomy_rules as $regex => $query ) {
$new_rules[ $regex ] = $query;
}
}
$post_type_slugs = array_unique( $post_type_slugs );

if ( ! empty( $pt_rules_top ) ) {
foreach ( $pt_rules_top as $regex => $query ) {
$new_rules[ $regex ] = $query;
}
}
$_rules = $rules;
foreach ( $rules as $regex => $query ) {
if ( isset( $_rules[ $regex ] ) && strpos( $query, '&geodir-api=' ) !== false ) {
unset( $_rules[ $regex ] );
continue;
}

if ( ! empty( $pt_rules ) ) {
foreach ( $pt_rules as $regex => $query ) {
$new_rules[ $regex ] = $query;
}
}
}
}
foreach ( $post_type_slugs as $key => $slug ) {
if ( isset( $_rules[ $regex ] ) && ( strpos( $regex, '^' . $slug . '/' ) === 0 || strpos( $regex, $slug . '/' ) === 0 ) && ( strpos( $query, '?attachment=' ) !== false || strpos( $query, '&attachment=' ) !== false || strpos( $query, '&tb=1' ) !== false || strpos( $query, '&embed=true' ) !== false ) ) {
unset( $_rules[ $regex ] );
}
$new_rules[ $_regex ] = $_query;
}

$rules = $new_rules;
}

$rules = $_rules;

return $rules;
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/widgets/class-geodir-widget-dynamic-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function set_arguments() {
'title' => __( 'Text:', 'geodirectory' ),
'desc' => __('Use %%input%% to use the input value of the field or %%post_url%% for the post url, or the field key for any other info %%email%%.', 'geodirectory'),
'type' => 'textarea',
'placeholder' => __( '', 'geodirectory' ),
'placeholder' => '', // __( '', 'geodirectory' ), @todo any reason to use empty?
'default' => '',
'desc_tip' => true,
'advanced' => false
Expand Down
Binary file modified languages/geodirectory-en_US.mo
Binary file not shown.
Loading

0 comments on commit 5e3c525

Please sign in to comment.