From 89980a677185679518b262e45ebf4f34ddebf4b4 Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Tue, 12 Oct 2021 14:30:27 +0200 Subject: [PATCH] page contact --- .../themes/pole-sbv/contact_en_template.php | 337 ------------------ .../themes/pole-sbv/contact_template.php | 230 +++++++----- wp-content/themes/pole-sbv/functions.php | 46 +++ .../themes/pole-sbv/inc/functs-contacts.php | 86 +++++ .../themes/pole-sbv/marques_en_template.php | 161 --------- 5 files changed, 263 insertions(+), 597 deletions(-) delete mode 100644 wp-content/themes/pole-sbv/contact_en_template.php create mode 100644 wp-content/themes/pole-sbv/inc/functs-contacts.php delete mode 100644 wp-content/themes/pole-sbv/marques_en_template.php diff --git a/wp-content/themes/pole-sbv/contact_en_template.php b/wp-content/themes/pole-sbv/contact_en_template.php deleted file mode 100644 index 0c0a4e17..00000000 --- a/wp-content/themes/pole-sbv/contact_en_template.php +++ /dev/null @@ -1,337 +0,0 @@ -"; - $bodyMail .= "Bonjour,
"; - $bodyMail .= "Un nouveau message consommateur a été renseigné :
"; - $bodyMail .= "Civilité :".$civilite."
"; - $bodyMail .= "Nom :".$nom."
"; - $bodyMail .= "Prénom :".$prenom."
"; - $bodyMail .= "Email :".$email."
"; - $bodyMail .= "Tél :".$telephone."
"; - $bodyMail .= "Adresse :".$adresse."
"; - $bodyMail .= "Code Postal :".$cp."
"; - $bodyMail .= "Ville :".$ville."

"; - $bodyMail .= "Type de message :".$tt."

"; - $bodyMail .= "Message :".$message."
"; - $bodyMail .= ""; - $subject = "Nouveau message du site SBV"; - wp_mail(array(CONTACT_MAIL), $subject, $bodyMail, "", $pj); - - $envoiDone = true; - - } - } else { - $errorMsg = "Merci de compléter tous les champs du formulaire."; - } - } else { - $errorMsg = "Merci de valider la captcha en bas du formulaire."; - } - - - } else { - $errorMsg = "Merci de valider la captcha en bas du formulaire."; - } -} - - -get_header(); ?> - - -
-
- -
-
-
-

- - Contact us - -

-
-
-
- -
-

Your message has been sent.

-

We will respond as soon as possible

-

Thank you

-
- - -
-

* Required Fields

- -

Contact Information :

-

- -

-

- - -

-

- - -

-

- - -

-

- -

-
-

-

Your request is about :

- -

-

- -

-
-

Upload a file :

-

- - Accepted formats : jpg, png, pdf
Max size : 3 Mo
- -

-
- - -
-

- -

-
- -
-
-
-
-

- - Our contacts - -

-
- -
-

- Head Office -

-

SBV & Celvia

-

Z.I. du Lay CS 10014
56 660 - Saint-Jean-Brévelay

-

Tel : +33 (0)2 97 60 33 88
Fax : +33 (0)2 97 60 30 80
contact@pole-sbv.fr

-
-
-

Procanar

-

Z.I. La Haie
56 190 - Lauzach

-

Tel : +33 (0)2 97 48 78 00
Fax : +33 (0)2 97 48 78 22
contact@procanar.fr
www.procanar.fr

-
-
-

Boscher Volailles

-

Z.A.C. de Guergadic
22 530 - Mur de Bretagne

-

Tel : +33 (0)2 96 67 10 30
Fax : +33 (0)2 96 67 10 32

-
-
-

LES VOLAILLES DE KERANNA

-

Keranna
56 560 - Guiscriff

-

Tel : +33 (0)2 97 34 05 23
Fax : +33 (0)2 97 34 00 32

-
-
-

LDC BRETAGNE

-

La Lande de la Forge
22 800 - Lanfains

-

Tel : +33 (0)2 96 74 85 75
Fax : +33 (0)2 96 74 05 42

-
-
-

CELTYS

-

Z.A. de Restavy
56 240 - Plouay

-

Tel : +33 (0)2 97 02 20 20
Fax : +33 (0)2 97 02 20 00

-
-
-

MICHEL ROBICHON

-

Z.I. de Kergoustard
12, rue Joseph Quilliou
56300 - Saint Thuriau

-

Tel : +33 (0)2 97 25 97 97
Fax : +33 (0)2 97 28 99 17
info@farmor.fr

-
-
-

FARMOR

-

Z.I. de Bellevue
29, avenue de l’Hippodrome
22 200 - Saint-Agathon

-

Tel : +33 (0)2 96 11 83 00
Fax : +33 (0)2 96 11 83 20
info@farmor.fr
www.farmor.fr

-
-
-

-

-

-
-
-

RVE

-

Les Cinq Chemins
56 580 - Crédin

-

Tel : +33 (0)2 97 51 58 58
Fax : +33 (0)2 97 38 93 79
info@farmor.fr

-
- -
-
-
-
-
- - - - - diff --git a/wp-content/themes/pole-sbv/contact_template.php b/wp-content/themes/pole-sbv/contact_template.php index aa2ba82b..af194ebb 100644 --- a/wp-content/themes/pole-sbv/contact_template.php +++ b/wp-content/themes/pole-sbv/contact_template.php @@ -19,7 +19,7 @@ if('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST[' $upload_dir = wp_upload_dir(); $pjFolder = WP_CONTENT_DIR.'/'."pj/" ; - $civilite = htmlspecialchars($_POST['civilite']); + $civilite = htmlspecialchars($_POST['civilite'] ?? ''); $nom = htmlspecialchars($_POST['nom']); $prenom = htmlspecialchars($_POST['prenom']); $email = htmlspecialchars($_POST['email']); @@ -27,7 +27,7 @@ if('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST[' $adresse = htmlspecialchars($_POST['adresse']); $cp = htmlspecialchars($_POST['cp']); $ville = htmlspecialchars($_POST['ville']); - $type = htmlspecialchars($_POST['contacttype']); + $type = htmlspecialchars($_POST['contacttype'] ?? ''); $message = htmlspecialchars($_POST['message']); if(isset($_POST['g-recaptcha-response'])) { $key = "6LdCuTQUAAAAALJ_1ZSa46Bd2TTCWi186yy2w09C"; @@ -51,7 +51,7 @@ if('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST[' if($nom != "" && $prenom != "" && $email != "" && $adresse != "" && $cp !="" && $ville !="") { $nonce = $_POST['token']; if (! wp_verify_nonce($nonce, 'contact-nonce') ) { - $errorMsg = "Une erreur est survenue, merci de recommencer."; + $errorMsg = pll__("Une erreur est survenue, merci de recommencer."); } else { // ---- Contrôle pièce jointe $finalFileName = ""; @@ -70,7 +70,7 @@ if('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST[' move_uploaded_file($tmpFileName, $pjFolder.$finalFileName); $pj[] = $pjFolder.$finalFileName; }else{ - $errorMsg = "La taille de votre pièce jointe ne doit pas dépasser les 3Mo. Merci de recommencer."; + $errorMsg = pll__("La taille de votre pièce jointe ne doit pas dépasser les 3Mo. Merci de recommencer."); } } @@ -113,36 +113,112 @@ if('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST[' } } else { - $errorMsg = "Merci de compléter tous les champs du formulaire."; + $errorMsg = pll__("Merci de compléter tous les champs du formulaire."); } } else { - $errorMsg = "Merci de valider la captcha en bas du formulaire."; + $errorMsg = pll__("Merci de valider la captcha en bas du formulaire."); } } else { - $errorMsg = "Merci de valider la captcha en bas du formulaire."; + $errorMsg = pll__("Merci de valider la captcha en bas du formulaire."); } } -get_header(); ?> +get_header(); + +function addhttp($url) { + if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { + $url = "https://" . $url; + } + return $url; +} + +/** + * + */ +function showContact($items) +{ + $finalstring = ""; + foreach ($items as $key=>$result) { + $id = $result->ID; + $title = $result->post_title; + + $adress = get_field("adresse", $id); + $adress2 = get_field("adresse_2", $id); + $code_postal = get_field("code_postal", $id); + $ville = get_field("ville", $id); + $tel = get_field("tel", $id); + $fax = get_field("fax", $id); + $email = get_field("email", $id); + $site_web = get_field("site_web", $id); + $site_web_link = addhttp($site_web); + + if ($adress2 != "") { + $adrsstmpl = <<%2\$s
%3\$s
%4\$s - %5\$s

+ ADR; + } else { + $adrsstmpl = <<%2\$s
%4\$s - %5\$s

+ ADR; + } + + if($site_web !="") { + $sitetmpl = <<%9\$s + WWW; + } else { + $sitetmpl = ""; + } + + if ($key === array_key_first($items)) { + $template = << +

+ Siège Social +

+

%1\$s

+ $adrsstmpl +

Tel : %6\$s
Fax : %7\$s
%8\$s$sitetmpl

+ + TMPL; + } else { + $template = << +

%1\$s

+ $adrsstmpl +

Tel : %6\$s
Fax : %7\$s
%8\$s$sitetmpl

+ + TMPL; + } + + + + $template = sprintf($template, $title, $adress, $adress2, number_format($code_postal, 0, ',', " "), $ville, $tel, $fax, $email, $site_web, $site_web_link); + + $finalstring .= $template; + } + echo $finalstring; +} +?>

- Nous contacter +

@@ -150,56 +226,56 @@ get_header(); ?>
-

Votre message a bien été envoyé.

+ Votre message a bien été envoyé.

Nous y répondrons dès que possible

-

Merci et à bientot

+

Merci et à bientot

') ?>
-

* Champs obligatoire

+

*

-

Coordonnées :

+

:

- - + +

- - + +

- - + +

- +


-

Votre question concerne :

+

:

- +

-

Joindre un fichier :

+

:

- Formats acceptés : jpg, png, pdf
Taille max : 3 Mo
+ : jpg, png, pdf
: 3 Mo

@@ -207,7 +283,7 @@ get_header(); ?>

- +

@@ -221,61 +297,17 @@ get_header(); ?>
+ -1, + 'post_type' => 'contact', + 'orderby' => 'menu_order', + 'order' => 'ASC', + ) + ); -
-

- Siège Social -

-

SBV & Celvia

-

Z.I. du Lay CS 10014
56 660 - Saint-Jean-Brévelay

-

Tel : +33 (0)2 97 60 33 88
Fax : +33 (0)2 97 60 30 80
contact@pole-sbv.fr

-
-
-

Procanar

-

Z.I. La Haie
56 190 - Lauzach

-

Tel : +33 (0)2 97 48 78 00
Fax : +33 (0)2 97 48 78 22
contact@procanar.fr
www.procanar.fr

-
-
-

Boscher Volailles

-

Z.A.C. de Guergadic
22 530 - Mur de Bretagne

-

Tel : +33 (0)2 96 67 10 30
Fax : +33 (0)2 96 67 10 32

-
-
-

LES VOLAILLES DE KERANNA

-

Keranna
56 560 - Guiscriff

-

Tel : +33 (0)2 97 34 05 23
Fax : +33 (0)2 97 34 00 32

-
-
-

LDC BRETAGNE

-

La Lande de la Forge
22 800 - Lanfains

-

Tel : +33 (0)2 96 74 85 75
Fax : +33 (0)2 96 74 05 42

-
-
-

CELTYS

-

Z.A. de Restavy
56 240 - Plouay

-

Tel : +33 (0)2 97 02 20 20
Fax : +33 (0)2 97 02 20 00

-
-
-

MICHEL ROBICHON

-

Z.I. de Kergoustard
12, rue Joseph Quilliou
56300 - Saint Thuriau

-

Tel : +33 (0)2 97 25 97 97
Fax : +33 (0)2 97 28 99 17
info@farmor.fr

-
-
-

FARMOR

-

Z.I. de Bellevue
29, avenue de l’Hippodrome
22 200 - Saint-Agathon

-

Tel : +33 (0)2 96 11 83 00
Fax : +33 (0)2 96 11 83 20
info@farmor.fr
www.farmor.fr

-
-
-

-

-

-
-
-

RVE

-

Les Cinq Chemins
56 580 - Crédin

-

Tel : +33 (0)2 97 51 58 58
Fax : +33 (0)2 97 38 93 79
info@farmor.fr

-
- + showContact($pstary) ?>
@@ -318,18 +350,18 @@ get_header(); ?> }, }, messages: { - civilite: "Veuillez renseigner votre civilité", - prenom: "Veuillez renseigner votre prénom", - nom: "Veuillez renseigner votre nom", - adresse: "Veuillez renseigner votre adresse", - cp: "Veuillez renseigner votre code postal", - ville: "Veuillez renseigner votre ville", + civilite: "", + prenom: "", + nom: "", + adresse: "", + cp: "", + ville: "", email:{ - required: "Veuillez renseigner une adresse mail", - email: "Votre adresse mail n'est pas dans un format valide" + required: "", + email: "" }, - contacttype: "Veuillez sélectionner un type de demande", - message: "Le message ne peut être vide", + contacttype: "", + message: "", }, errorContainer: "#error-msg", errorLabelContainer: "#error-msg ul", diff --git a/wp-content/themes/pole-sbv/functions.php b/wp-content/themes/pole-sbv/functions.php index 23e757f5..41671294 100644 --- a/wp-content/themes/pole-sbv/functions.php +++ b/wp-content/themes/pole-sbv/functions.php @@ -13,6 +13,7 @@ if (is_admin()) { // ---- Custom post type get_template_part('inc/functs', 'custompicto'); get_template_part('inc/functs', 'metiers'); +get_template_part('inc/functs', 'contacts'); // ------ Upload dans dossier spécifique @@ -118,6 +119,51 @@ pll_register_string("Découvrez_un_élevage","Découvrez un élevage de poulets pll_register_string("International","International",'Miscellaneous'); pll_register_string("Nous_produisons","Nous produisons également selon vos cahiers des charges pour vos marques distributeurs françaises et européennes en grande distribution traditionnelle, hard discount et freezer center.",'Nos Marques'); +pll_register_string("Nous contacter","Nous contacter","Contact"); +pll_register_string("Champs obligatoire","Champs obligatoire","Miscellaneous"); +pll_register_string("Coordonnées","Coordonnées","Contact"); +pll_register_string("Civilité","Civilité","Contact"); +pll_register_string("Mr","Mr","Contact"); +pll_register_string("Mme","Mme","Contact"); +pll_register_string("Nom","Nom","Contact"); +pll_register_string("Prénom","Prénom","Contact"); +pll_register_string("Adresse","Adresse","Contact"); +pll_register_string("Adresse mail","Adresse mail","Contact"); +pll_register_string("Code Postal","Code Postal","Contact"); +pll_register_string("Ville","Ville","Contact"); +pll_register_string("Téléphone","Téléphone","Contact"); +pll_register_string("Votre question concerne","Votre question concerne","Contact"); +pll_register_string("Sélectionnez une demande","Sélectionnez une demande","Contact"); +pll_register_string("Recrutement","Recrutement","Contact"); +pll_register_string("Besoin Commercial","Besoin Commercial","Contact"); +pll_register_string("Relation Presse","Relation Presse","Contact"); +pll_register_string("Autre demande","Autre demande","Contact"); +pll_register_string("Message","Message","Contact"); +pll_register_string("Joindre un fichier","Joindre un fichier","Contact"); +pll_register_string("Formats acceptés","Formats acceptés","Contact"); +pll_register_string("Taille max","Taille max","Contact"); +pll_register_string("Message OK","

Votre message a bien été envoyé.

+

Nous y répondrons dès que possible

+

Merci et à bientot

","Contact"); +pll_register_string("Message Error piece","La taille de votre pièce jointe ne doit pas dépasser les 3Mo. Merci de recommencer.","Contact"); +pll_register_string("Message Error","Une erreur est survenue, merci de recommencer.","Contact"); +pll_register_string("Message Error fields","Merci de compléter tous les champs du formulaire.","Contact"); +pll_register_string("Message Error captcha","Merci de valider la captcha en bas du formulaire.","Contact"); +pll_register_string("Envoyer","Envoyer","Miscellaneous"); + + +pll_register_string("error_civilite","Veuillez renseigner votre civilité","form_errors"); +pll_register_string("error_prenom","Veuillez renseigner votre prénom","form_errors"); +pll_register_string("error_nom","Veuillez renseigner votre nom","form_errors"); +pll_register_string("error_adresse","Veuillez renseigner votre adresse","form_errors"); +pll_register_string("error_cp","Veuillez renseigner votre code postal","form_errors"); +pll_register_string("error_ville","Veuillez renseigner votre ville","form_errors"); +pll_register_string("error_email_required","Veuillez renseigner une adresse mail","form_errors"); +pll_register_string("error_email_email","Votre adresse mail n'est pas dans un format valide","form_errors"); +pll_register_string("error_contacttype","Veuillez sélectionner un type de demande","form_errors"); +pll_register_string("error_message","Le message ne peut être vide","form_errors"); + + pll_register_string('Une histoire de terre footer', 'Une histoire de terre', 'Footer'); pll_register_string("Une histoire d'Hommes footer", "Une histoire d'Hommes", 'Footer'); diff --git a/wp-content/themes/pole-sbv/inc/functs-contacts.php b/wp-content/themes/pole-sbv/inc/functs-contacts.php new file mode 100644 index 00000000..da20853f --- /dev/null +++ b/wp-content/themes/pole-sbv/inc/functs-contacts.php @@ -0,0 +1,86 @@ + array( + 'name' => __('contact'), + 'singular_name' => __('Contact'), + 'menu_name' => __('Contacts'), + 'all_items' => __('Tous les contacts'), + 'view_item' => __('Voir les contacts'), + 'add_new_item' => __('Ajouter un contact'), + 'add_new' => __('Ajouter'), + 'edit_item' => __('Editer le contact'), + 'update_item' => __('Modifier le contact'), + 'search_items' => __('Rechercher un contact'), + 'not_found' => __('Non trouvé'), + 'not_found_in_trash' => __('Non trouvé dans la corbeille'), + ), + 'supports' => array( 'title'), + 'public' => true, + 'has_archive' => true, + 'rewrite' => array('slug' => 'contact'), + 'menu_icon' => 'dashicons-email', + ) + ); +} + +add_action('init', 'create_contact'); + +// ---- Supprime Yoast du CPT +function remove_yoast_cpt_contact() +{ + remove_meta_box('wpseo_meta', "contact", 'normal'); +} +add_action('add_meta_boxes', 'remove_yoast_cpt_contact', 100); + +// function custom_contact() +// { +// $labels = array( +// 'name' => _x('contact', 'Post Type General Name', 'twentythirteen'), +// 'singular_name' => _x('Contact', 'Post Type Singular Name', 'twentythirteen'), +// 'menu_name' => __('Contact', 'twentythirteen'), +// 'parent_item_colon' => '', +// 'all_items' => __('All', 'twentythirteen'), +// 'view_item' => __('View', 'twentythirteen'), +// 'add_new_item' => __('Add New', 'twentythirteen'), +// 'add_new' => __('Add New', 'twentythirteen'), +// 'edit_item' => __('Edit', 'twentythirteen'), +// 'update_item' => __('Update', 'twentythirteen'), +// 'search_items' => __('Search', 'twentythirteen'), +// 'not_found' => __('Not Found', 'twentythirteen'), +// 'not_found_in_trash' => __('Not found in Trash', 'twentythirteen'), +// ); + +// $args = array( +// 'label' => __('Contact', 'twentythirteen'), +// 'description' => __('', 'twentythirteen'), +// 'labels' => $labels, +// 'supports' => array( 'title', 'editor', '', '', 'thumbnail', '', '', ''), +// //'taxonomies' => array('post_tag'), +// 'hierarchical' => false, +// 'public' => true, +// 'show_ui' => true, +// 'show_in_menu' => true, +// 'show_in_nav_menus' => true, +// 'show_in_admin_bar' => true, +// 'menu_position' => 3, +// 'can_export' => true, +// 'has_archive' => true, +// 'exclude_from_search' => false, +// 'publicly_queryable' => true, +// 'capability_type' => 'page', +// ); + +// register_post_type('contact', $args); +// } + +// add_action('init', 'custom_contact', 0); + +?> diff --git a/wp-content/themes/pole-sbv/marques_en_template.php b/wp-content/themes/pole-sbv/marques_en_template.php deleted file mode 100644 index 031066f2..00000000 --- a/wp-content/themes/pole-sbv/marques_en_template.php +++ /dev/null @@ -1,161 +0,0 @@ - - - -
-
-
-
-

- - Commercial & institutional catering establishments - -

-
-

Our brands and solutions for commercial and institutional catering establishments:

-
- Domaine de Lanvaux -
-

- POULE et TOQUE : The poultry brand dedicated to catering professionals for everyday menus. -

-
-
-
- Domaine de Lanvaux -
-

- Domaine de Lanvaux : High-quality poultry that is guaranteed of French origin: cuts of duck, foie gras, raw dishes and poultry confit. -

-
-
-
- Le Gaulois Professionnel -
-

- Le Gaulois Professionnel : 100% French poultry, a sign of quality and innovation. -

-
-
-
- Domaine de Lanvaux -
-

- Cocotte de Bretagne : A brand of farm poultry “Label Rouge” from a traditional breeding mode providing organoleptic guarantees, animal welfare and product quality. -

-
-
-
- Farmor -
-

- Farmor : Competitive prepared products. -

-
-
-
- ID Halal -
-

- ID Halal : For halal butcher shops and establishments, strict and guaranteed traceability. -

-
-
-
- - -
-
-
-
-

- - Hypermarkets & supermarkets - -

-
-

Our products are sold under our brand names in hypermarkets and supermarkets around France and Europe:

- -
- -
-

- Brittany: Kerchant, Volailles des Légendes, Fermiers d’Argoat and Fermier de Bretagne Label Rouge.
Discover a Label Rouge poultry breeding -

- Ker Chant - Fermiers d'Argoat - Fermiers de Bretagne - Volailles des Légendes -
-
-

- France : -

-
- Reghalal -
-

- Réghalal, a major player on the halal market, with guaranteed strict traceability that is controlled by the Evry Courcouronnes mosque and a unique, complete range of made-in-France products. More informations on Réghalal. -

- -
-
-
- Canard Passion -
-

- Canard Passion, the brand specialising in duck products, offers a variety of recipes and cuts to make cooking with duck meat more accessible. -

- -
-
-

International :

-
- Prim's -
-

- Prim’S, the expert in frozen poultry products and an ambassador or French expertise in Europe with raw and cooked products. -

- -
-
-
- Doux -
-

- Doux, Expert in poultry products for Export. -

-
-

- We also offer products prepared according to your specifications for your French and European own brands in traditional supermarkets, hard discounts stores and freezer centres. -

-
-
-
-
-
- - - -