Skip to content

Commit

Permalink
Merge pull request #6 from Eoxia/2.3.0
Browse files Browse the repository at this point in the history
2.3.0
  • Loading branch information
eoxia-amandine authored Mar 12, 2024
2 parents e201dd1 + 34c94e8 commit 9a8d650
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 1,081 deletions.
2 changes: 1 addition & 1 deletion annonces.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Annonces
* Plugin URI:
* Description: Add all type of announces you need to display in a large map.
* Version: 2.2.0
* Version: 2.3.0
* Author: Eoxia <[email protected]>
* Author URI: http://www.eoxia.com/
* License: AGPLv3
Expand Down
2 changes: 1 addition & 1 deletion core/asset/js/backend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions modules/annonce/asset/js/annonce.backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ function annonceCreateMap( map ) {
var myLatlng = new google.maps.LatLng($markers.attr('lat'),$markers.attr('lng'));
var $listMarker = [];
var $htmlMarker = [];
var args = {
var defaultArgs = {
zoom: 8,
center: myLatlng,
fullscreenControl: false,
};
var $gMap = new google.maps.Map( jQuery( $map ).find( '#annonces-google-map' )[0], args );
var customArgs = $map.data('map');
var infoWindowTemp = false;

var $gMap = new google.maps.Map( jQuery( $map ).find( '#annonces-google-map' )[0], jQuery.extend( defaultArgs, customArgs ) );


jQuery( $markers ).each(function() {
Expand All @@ -57,6 +60,11 @@ function annonceCreateMap( map ) {

if ( jQuery( this ).html().length != 0 ) {
marker.addListener('click', function() {
if ( infoWindowTemp ) {
infoWindowTemp.close();
}

infoWindowTemp = infoWindow;
infoWindow.open($map, marker);
});
}
Expand Down
7 changes: 5 additions & 2 deletions modules/annonce/filter/annonce.filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public function annonces_annonce_json_load( $paths ) {
public function get_custom_post_type_template( $single_template ) {
global $post;

$view_template = \annonces\Annonces_Util::get_instance()->get_module_view_path( 'annonce', 'single-announce' );
return $view_template;
if ( is_singular( 'announce' ) ) {
$single_template = \annonces\Annonces_Util::get_instance()->get_module_view_path( 'annonce', 'single-announce' );
}

return $single_template;
}
}

Expand Down
21 changes: 21 additions & 0 deletions modules/annonce/shortcode/annonce.shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ public function annonces_display_shortcode( $atts ) {
$filter_title = __( 'Announces', 'annonces' );
$taxonomies_datas->taxonomies_title = apply_filters( 'bloc_filter_title', $filter_title );

$shortcode_atts = shortcode_atts( array(
'mapargs' => '',
), $atts, 'annonces' );

if ( ! empty( $shortcode_atts['mapargs'] ) ) {
$map_args = array();
$map_args_data = explode( ',', $shortcode_atts['mapargs'] );
foreach ( $map_args_data as $map_arg ) {
$arg = explode( ':', $map_arg ); // Separe name and value
$parenthese = preg_match( '#\(+(.*)\)+#', $arg[1], $value_type ); // Get value type in parenthesis
$arg_value = preg_replace( '#\(+(.*)\)+#', '', $arg[1]); // Delete value type
if ( ! empty( $value_type ) ) {
settype($arg_value, $value_type[1]); // Change type of value according to parenthesis
}

$map_args[$arg[0]] = $arg_value;
}

$shortcode_atts['mapargs'] = $map_args;
}

ob_start();
$view_path = \annonces\Annonces_Util::get_instance()->get_module_view_path( 'annonce', 'main.view' );
include $view_path;
Expand Down
34 changes: 18 additions & 16 deletions modules/annonce/view/main-taxonomies.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,26 @@

defined( 'ABSPATH' ) || exit; ?>

<div class="annonces-taxonomies">
<?php if ( ! empty( $taxonomies_datas->taxonomies_parent ) ) : ?>
<div class="annonces-taxonomies">

<div class="taxonomies-entete">
<?php echo esc_html( $taxonomies_datas->taxonomies_title ); ?>
</div>
<div class="taxonomies-entete">
<?php echo esc_html( $taxonomies_datas->taxonomies_title ); ?>
</div>

<div class="taxonomies-container">
<?php foreach ( $taxonomies_datas->taxonomies_parent as $parent ) : ?>
<div class="annonces-taxonomy">
<img src="<?php echo esc_url( $parent->marker ); ?>" />
<span class="taxonomy-label active" data-id="<?php echo esc_attr( $parent->list_tax_id ); ?>"><?php echo esc_html( $parent->name ); ?></span>
<div class="taxonomies-container">
<?php foreach ( $taxonomies_datas->taxonomies_parent as $parent ) : ?>
<div class="annonces-taxonomy">
<img src="<?php echo esc_url( $parent->marker ); ?>" />
<span class="taxonomy-label active" data-id="<?php echo esc_attr( $parent->list_tax_id ); ?>"><?php echo esc_html( $parent->name ); ?></span>

<div class="taxonomies-child">
<?php foreach ( $parent->taxonomies_child as $child ) : ?>
<span class="taxonomy-label active" data-id="<?php echo esc_attr( $child->term_id ); ?>"><?php echo esc_html( $child->name ); ?></span>
<?php endforeach; ?>
<div class="taxonomies-child">
<?php foreach ( $parent->taxonomies_child as $child ) : ?>
<span class="taxonomy-label active" data-id="<?php echo esc_attr( $child->term_id ); ?>"><?php echo esc_html( $child->name ); ?></span>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
2 changes: 1 addition & 1 deletion modules/annonce/view/main.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

defined( 'ABSPATH' ) || exit; ?>

<div id="annonces-map-wrapper">
<div id="annonces-map-wrapper" data-map=<?php echo ! empty( $shortcode_atts['mapargs'] ) ? wp_json_encode( $shortcode_atts['mapargs'] ) : ''; ?>>
<div id="annonces-google-map">
<markers>
<?php
Expand Down
Loading

0 comments on commit 9a8d650

Please sign in to comment.