Skip to content

Commit

Permalink
Merge pull request #2 from Eoxia/2.1.0
Browse files Browse the repository at this point in the history
2.1.0
  • Loading branch information
eoxia-amandine authored Jul 26, 2018
2 parents 02668f9 + b69f83a commit 3e4c396
Show file tree
Hide file tree
Showing 51 changed files with 1,108 additions and 140 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function mytheme_set_marker_data($microdata, $annonce_id) {
#### Change title of filter bloc over the map
```
add_filter('bloc_filter_title', 'mytheme_set_filter_title', 10, 1);
function mytheme_set_marker_data($filter_title) {
function mytheme_set_filter_title($filter_title) {
// datas
return $filter_title;
}
Expand Down
6 changes: 4 additions & 2 deletions annonces.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"modules": [
"core/core.config.json",
"modules/option/option.config.json",
"modules/annonce/annonce.config.json"
"modules/annonce/annonce.config.json",
"modules/label/label.config.json",
"modules/contact/contact.config.json"
],
"version": "2.0.0"
"version": "2.1.0"
}
20 changes: 18 additions & 2 deletions 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.0.0
* Version: 2.1.0
* Author: Eoxia <[email protected]>
* Author URI: http://www.eoxia.com/
* License: AGPL-3.0 or later
Expand All @@ -23,11 +23,27 @@
/**
* Enable ACF 5 early access
*/
DEFINE( 'ACF_EARLY_ACCESS', '5' );
if ( ! defined( 'ACF_EARLY_ACCESS' ) ) {
DEFINE( 'ACF_EARLY_ACCESS', '5' );
}

// Include EO_Framework.
require_once 'core/external/eo-framework/eo-framework.php';

/**
* Regenerate permalinks
*
* @since 2.1.0
* @return void
*/
function my_rewrite_flush() {
Annonce_Action::g()->annonces_generate_post_type;
Label_Action::g()->label_generate_post_type;

flush_rewrite_rules();
}
register_activation_hook( __FILE__, '\annonces\my_rewrite_flush' );


// Boot your plugin.
\eoxia\Init_Util::g()->exec( PLUGIN_ANNONCES_PATH, basename( __FILE__, '.php' ) );
2 changes: 1 addition & 1 deletion core/action/core.action.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public function callback_front_enqueue_scripts() {
wp_enqueue_script( 'annonces-frontend-script' );

/** Aller chercher la clé entrée dans les options de configuration */
// $api_key = 'AIzaSyAjNX-2ycIAskm4GmdWpmYhSG0XCHB2KgY';
$api_key = get_option( 'annonces_google_key' );
wp_enqueue_script( 'annonces-google-map-api', 'https://maps.googleapis.com/maps/api/js?key=' . $api_key, array(), '', true );
}
Expand All @@ -74,6 +73,7 @@ public function callback_front_enqueue_scripts() {
*/
public function acf_version_notice() {
if ( ! is_acf() ) return;
if ( ! file_exists( PLUGIN_ANNONCES_PATH . '/../advanced-custom-fields/acf.php' ) ) return;

$acf_datas = get_plugin_data( PLUGIN_ANNONCES_PATH . '/../advanced-custom-fields/acf.php' );
if ( (int) substr( $acf_datas['Version'], 0, 1 ) < 5 ) {
Expand Down
4 changes: 4 additions & 0 deletions core/asset/css/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
* @since 0.1.0
* @version 0.1.0
*/

$media__large: 1200px;
$media__medium: 770px;
$media__small: 480px;
1 change: 1 addition & 0 deletions core/asset/css/scss/modules/_modules.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import "annonce/annonce";
@import "label/label";
1 change: 1 addition & 0 deletions core/asset/css/scss/modules/annonce/_annonce.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "map";
@import "single";
@import "associated";

#annonces-google-map {
width: 100%;
Expand Down
12 changes: 12 additions & 0 deletions core/asset/css/scss/modules/annonce/_associated.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.associated-announces .associated-content {
.associated-element-content {
align-self: center;
}
.element-title, .element-tax {
line-height: 1;
}
figure img {
max-height: 100px;
width: auto;
}
}
10 changes: 10 additions & 0 deletions core/asset/css/scss/modules/annonce/_map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
max-width: 240px;
box-shadow: 0 0 40px rgba(0,0,0,0.2);

@media ( max-width: $media__medium ) {
left: 0;
top: 0;
right: 0;
width: 100%;
max-width: none;
max-height: 160px;
transform: none;
}

.taxonomies-entete {
padding: 1em;
background: rgba(0,0,0,0.1);
Expand Down
Empty file.
25 changes: 25 additions & 0 deletions core/asset/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@
-webkit-box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 40px rgba(0, 0, 0, 0.2); }

@media (max-width: 770px) {
#annonces-map-wrapper .annonces-taxonomies {
left: 0;
top: 0;
right: 0;
width: 100%;
max-width: none;
max-height: 160px;
-webkit-transform: none;
-ms-transform: none;
transform: none; } }

#annonces-map-wrapper .annonces-taxonomies .taxonomies-entete {
padding: 1em;
background: rgba(0, 0, 0, 0.1); }
Expand Down Expand Up @@ -151,6 +163,19 @@
#annonces-google-map {
margin: 2em 0; }

.associated-announces .associated-content .associated-element-content {
-webkit-align-self: center;
-ms-flex-item-align: center;
-ms-grid-row-align: center;
align-self: center; }

.associated-announces .associated-content .element-title, .associated-announces .associated-content .element-tax {
line-height: 1; }

.associated-announces .associated-content figure img {
max-height: 100px;
width: auto; }

#annonces-google-map {
width: 100%;
height: 500px;
Expand Down
2 changes: 1 addition & 1 deletion core/asset/css/style.min.css

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

16 changes: 10 additions & 6 deletions core/asset/js/backend.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ window.eoxiaJS.annonces.annonce.createMap = function( map ) {

jQuery( '.annonces-taxonomies .taxonomy-label' ).on( 'click', function() {
if ( jQuery( this ).hasClass( 'active' ) ) {
window.eoxiaJS.annonces.annonce.displayMapMarkers( $htmlMarker, $listMarker, null, jQuery( this ).attr( 'data-id' ) );
window.eoxiaJS.annonces.annonce.displayMapMarkers( $htmlMarker, $listMarker, null, jQuery( this ).attr( 'data-id' ).split( ',' ) );
jQuery( this ).removeClass( 'active' );
jQuery( this ).next('.taxonomies-child').find( '.taxonomy-label' ).removeClass( 'active' );
} else {
window.eoxiaJS.annonces.annonce.displayMapMarkers( $htmlMarker, $listMarker, $gMap, jQuery( this ).attr( 'data-id' ) );
window.eoxiaJS.annonces.annonce.displayMapMarkers( $htmlMarker, $listMarker, $gMap, jQuery( this ).attr( 'data-id' ).split( ',' ) );
jQuery( this ).addClass( 'active' );
jQuery( this ).next('.taxonomies-child').find( '.taxonomy-label' ).addClass( 'active' );
}
Expand Down Expand Up @@ -169,13 +169,17 @@ window.eoxiaJS.annonces.annonce.createInfoWindow = function( marker ) {
* @param {Array} map Map
* @return {void}
*/
window.eoxiaJS.annonces.annonce.displayMapMarkers = function( htmlMarker, listMarkers, map, taxId ) {
window.eoxiaJS.annonces.annonce.displayMapMarkers = function( htmlMarker, listMarkers, map, listTaxId ) {
for (var i = 0; i < listMarkers.length; i++) {
var taxonomies = htmlMarker[i].attr( 'taxonomy' ).split( ',' );
/** Loop over all markers */
taxonomies.forEach(function(tax) {
if ( tax == taxId ) {
listMarkers[i].setMap(map);
}
/** Loop over all chosen taxonomies */
listTaxId.forEach(function(id) {
if ( tax == id ) {
listMarkers[i].setMap(map);
}
});
});
}
}
Expand Down
Binary file modified core/asset/languages/annonces-fr_FR.mo
Binary file not shown.
79 changes: 66 additions & 13 deletions core/asset/languages/annonces-fr_FR.po
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
msgid ""
msgstr ""
"Project-Id-Version: Annonces v2.x.x\n"
"POT-Creation-Date: 2018-07-02 17:49+0200\n"
"PO-Revision-Date: 2018-07-02 17:49+0200\n"
"POT-Creation-Date: 2018-07-17 17:34+0200\n"
"PO-Revision-Date: 2018-07-18 14:52+0200\n"
"Last-Translator: \n"
"Language-Team: Eoxia [email protected]\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.8\n"
"X-Generator: Poedit 2.0.9\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
Expand Down Expand Up @@ -120,43 +120,79 @@ msgstr "Retourner à la page d'installation des extensions requises"

#: core/util/core.util.php:84
msgid "Plugin activated successfully."
msgstr "L'extension a été activée"
msgstr "L'extension a été activée."

#: core/util/core.util.php:85
#, php-format
msgid "All plugins installed and activated successfully. %s"
msgstr "Tous les plugins ont été installés et activés : %s."
msgstr "Tous les plugins ont été installés et activés : %s"

#: modules/annonce/action/annonce.action.php:42
#: modules/annonce/action/annonce.action.php:43
#: modules/annonce/shortcode/annonce.shortcode.php:91
#: modules/annonce/action/annonce.action.php:63
#: modules/annonce/shortcode/annonce.shortcode.php:114
#: modules/option/action/option.action.php:41
#: modules/option/action/option.action.php:77
#: modules/option/action/option.action.php:82
msgid "Announces"
msgstr "Annonces"

#: modules/annonce/action/annonce.action.php:46
#: modules/annonce/action/annonce.action.php:66
msgid "Announce"
msgstr "Annonce"

#: modules/annonce/action/annonce.action.php:82
msgid "Announce taxonomy"
#: modules/annonce/action/annonce.action.php:101
#: modules/annonce/action/annonce.action.php:102
msgid "Announce taxonomies"
msgstr "Catégories annonces"

#: modules/annonce/shortcode/annonce.shortcode.php:46
#: modules/annonce/action/annonce.action.php:118
msgid "Announce taxonomy"
msgstr "Catégorie annonces"

#: modules/annonce/shortcode/annonce.shortcode.php:48
#: modules/annonce/view/single-announce.php:37
msgid "Email"
msgstr "Email"

#: modules/annonce/shortcode/annonce.shortcode.php:51
#: modules/annonce/shortcode/annonce.shortcode.php:53
#: modules/annonce/view/single-announce.php:43
msgid "Phone number"
msgstr "Numéro de téléphone"

#: modules/annonce/shortcode/annonce.shortcode.php:58
#: modules/annonce/view/single-announce.php:49
msgid "Address"
msgstr "Adresse"

#: modules/annonce/view/main-markers.view.php:46
msgid "See"
msgstr "Voir"

#: modules/option/action/option.action.php:84
#: modules/annonce/view/single-announce.php:60
msgid "Author"
msgstr "Auteur"

#: modules/annonce/view/single-announce.php:71
msgid "Associated labels"
msgstr "Certifications associées"

#: modules/contact/view/main.view.php:19 modules/label/view/single-label.php:57
msgid "Associated announces"
msgstr "Annonces associées"

#: modules/label/action/label.action.php:41
msgid "Labels"
msgstr "Certifications"

#: modules/label/action/label.action.php:44
msgid "Label"
msgstr "Certification"

#: modules/label/view/single-label.php:37
msgid "Website"
msgstr "Site internet"

#: modules/option/action/option.action.php:89
msgid "Permalink Announce"
msgstr "Permalien de Annonces"

Expand All @@ -173,8 +209,25 @@ msgid "Obtain a google map api key"
msgstr "Obtenir une clé API Google Map"

#: modules/option/view/main.view.php:32
msgid "Display label module"
msgstr "Afficher le module appellation"

#: modules/option/view/main.view.php:36
msgid "Activate"
msgstr "Activer"

#: modules/option/view/main.view.php:39
msgid "Check to display the label module"
msgstr "Cocher pour afficher le module Appellation"

#: modules/option/view/main.view.php:44
msgid "Update"
msgstr "Mise à jour"

#, fuzzy
#~| msgid "Announces"
#~ msgid "Annonces"
#~ msgstr "Annonces"

#~ msgid "You have to reload website permalinks after changing"
#~ msgstr "Vous devrez par la suite mettre à jour les permaliens de votre site"
3 changes: 2 additions & 1 deletion core/core.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"action": {},
"class": {},
"util": {},
"helper": {}
"helper": {},
"filter" : {}
}
}
47 changes: 47 additions & 0 deletions core/filter/core.filter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Mains filters of module
*
* @author Eoxia <[email protected]>
* @copyright (c) 2006-2018 Eoxia <[email protected]>
* @license AGPLv3 <https://spdx.org/licenses/AGPL-3.0-or-later.html>
* @package Annonces\Actions
* @since 2.0.0
*/

namespace annonces;

defined( 'ABSPATH' ) || exit;

/**
* Main actions of annonces
*/
class Core_Filter {

/**
* Constructor
*
* @since 2.0.0
*/
public function __construct() {
add_filter( 'acf/fields/google_map/api', array( $this, 'acf_filter_googlemap_api' ), 11 );
}

/**
* Change google map api key for ACF Map
*
* @since 2.0.0
*
* @param string $api Google key.
*
* @return string $api Google key.
*/
public function acf_filter_googlemap_api( $api ) {
$api_key = get_option( 'annonces_google_key' );
$api['key'] = ( ! empty( $api_key ) ) ? $api_key : '';
return $api;
}

}

new Core_Filter();
Empty file added core/filter/index.php
Empty file.
Loading

0 comments on commit 3e4c396

Please sign in to comment.