config mail
This commit is contained in:
parent
b101d3952a
commit
945d59520a
2 changed files with 120 additions and 106 deletions
|
|
@ -126,6 +126,9 @@ define('SMTP_AUTH', evalBool($_ENV['SMTP_AUTH']));
|
|||
define('SMTP_USER', $_ENV['SMTP_USER']);
|
||||
define('SMTP_PASS', $_ENV['SMTP_PASS']);
|
||||
define('SMTP_SECURE', $_ENV['SMTP_SECURE']);
|
||||
define('SENDER_MAIL', 'marie@ldc-crm.fr');
|
||||
define('SENDERNAME_MAIL', 'Marie');
|
||||
define('FROM_MAIL', 'noreply@marie.fr');
|
||||
define('CONTACT_RECIPIENT', $_ENV['CONTACT_RECIPIENT']);
|
||||
define('MAIL_PASSERELLE', $_ENV['MAIL_PASSERELLE']);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,39 @@
|
|||
<?php
|
||||
/** Pour spliter le fichier functions */
|
||||
get_template_part( 'inc/functs', 'templateconf' );
|
||||
get_template_part( 'inc/functs', 'navigationmenu' );
|
||||
get_template_part( 'inc/functs', 'sidebar' );
|
||||
if (is_admin()){
|
||||
get_template_part( 'inc/functs', 'adminonly' );
|
||||
/**
|
||||
*
|
||||
* Pour spliter le fichier functions
|
||||
*/
|
||||
get_template_part('inc/functs', 'templateconf');
|
||||
get_template_part('inc/functs', 'navigationmenu');
|
||||
get_template_part('inc/functs', 'sidebar');
|
||||
if (is_admin()) {
|
||||
get_template_part('inc/functs', 'adminonly');
|
||||
}else{
|
||||
get_template_part( 'inc/functs', 'frontendonly' );
|
||||
get_template_part('inc/functs', 'frontendonly');
|
||||
}
|
||||
// ---- Custom post type
|
||||
get_template_part( 'inc/functs', 'custompicto' );
|
||||
get_template_part( 'inc/functs', 'metiers' );
|
||||
get_template_part('inc/functs', 'custompicto');
|
||||
get_template_part('inc/functs', 'metiers');
|
||||
|
||||
|
||||
// ------ Upload dans dossier spécifique
|
||||
get_template_part( 'inc/functs', 'upload' );
|
||||
get_template_part('inc/functs', 'upload');
|
||||
|
||||
function wpse_allowedtags() {
|
||||
function wpse_allowedtags()
|
||||
{
|
||||
// Add custom tags to this string
|
||||
return '<script>,<style>,<br>,<em>,<i>,<ul>,<ol>,<li>,<a>,<p>,<img>,<video>,<audio>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) :
|
||||
if (! function_exists('wpse_custom_wp_trim_excerpt') ) :
|
||||
|
||||
function wpse_custom_wp_trim_excerpt($wpse_excerpt) {
|
||||
$raw_excerpt = $wpse_excerpt;
|
||||
if ( '' == $wpse_excerpt ) {
|
||||
function wpse_custom_wp_trim_excerpt($wpse_excerpt)
|
||||
{
|
||||
$raw_excerpt = $wpse_excerpt;
|
||||
if ('' == $wpse_excerpt ) {
|
||||
|
||||
$wpse_excerpt = get_the_content('');
|
||||
$wpse_excerpt = strip_shortcodes( $wpse_excerpt );
|
||||
$wpse_excerpt = strip_shortcodes($wpse_excerpt);
|
||||
$wpse_excerpt = apply_filters('the_content', $wpse_excerpt);
|
||||
$wpse_excerpt = str_replace(']]>', ']]>', $wpse_excerpt);
|
||||
$wpse_excerpt = strip_tags($wpse_excerpt, wpse_allowedtags()); /*IF you need to allow just certain tags. Delete if all tags are allowed */
|
||||
|
|
@ -43,21 +48,21 @@ if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) :
|
|||
// Divide the string into tokens; HTML tags, or words, followed by any whitespace
|
||||
preg_match_all('/(<[^>]+>|[^<>\s]+)\s*/u', $wpse_excerpt, $tokens);
|
||||
|
||||
foreach ($tokens[0] as $token) {
|
||||
foreach ($tokens[0] as $token) {
|
||||
|
||||
if ($count >= $excerpt_length && preg_match('/[\,\;\?\.\!]\s*$/uS', $token)) {
|
||||
if ($count >= $excerpt_length && preg_match('/[\,\;\?\.\!]\s*$/uS', $token)) {
|
||||
// Limit reached, continue until , ; ? . or ! occur at the end
|
||||
$excerptOutput .= trim($token);
|
||||
break;
|
||||
}
|
||||
|
||||
// Add words to complete sentence
|
||||
$count++;
|
||||
|
||||
// Append what's left of the token
|
||||
$excerptOutput .= $token;
|
||||
$excerptOutput .= trim($token);
|
||||
break;
|
||||
}
|
||||
|
||||
// Add words to complete sentence
|
||||
$count++;
|
||||
|
||||
// Append what's left of the token
|
||||
$excerptOutput .= $token;
|
||||
}
|
||||
|
||||
$wpse_excerpt = trim(force_balance_tags($excerptOutput));
|
||||
|
||||
$excerpt_end = ' ';
|
||||
|
|
@ -82,62 +87,65 @@ endif;
|
|||
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
|
||||
add_filter('get_the_excerpt', 'wpse_custom_wp_trim_excerpt');
|
||||
|
||||
define('DISALLOW_FILE_EDIT',true);
|
||||
define('DISALLOW_FILE_EDIT', true);
|
||||
|
||||
//Register String
|
||||
|
||||
|
||||
pll_register_string( 'Qui sommes-nous ?', 'Qui sommes-nous ?', 'Menu');
|
||||
pll_register_string( 'Une histoire de terre', 'Une histoire de <br> terre', 'Menu');
|
||||
pll_register_string( "Une histoire d'Hommes", "Une histoire <br> d'Hommes", 'Menu');
|
||||
pll_register_string( "Une histoire de savoir-faire", "Une histoire de <br> savoir-faire", 'Menu');
|
||||
pll_register_string( "Nos solutions au service de nos clients", "Nos solutions au <br> service de nos clients", 'Menu');
|
||||
pll_register_string( "Nos marques", "Nos marques", 'Menu');
|
||||
pll_register_string( 'Actualités', 'Actualités', 'Menu');
|
||||
pll_register_string( 'Contact', 'Contact', 'Menu');
|
||||
pll_register_string( 'Nous rejoindre', 'Nous rejoindre', 'Menu');
|
||||
pll_register_string('Qui sommes-nous ?', 'Qui sommes-nous ?', 'Menu');
|
||||
pll_register_string('Une histoire de terre', 'Une histoire de <br> terre', 'Menu');
|
||||
pll_register_string("Une histoire d'Hommes", "Une histoire <br> d'Hommes", 'Menu');
|
||||
pll_register_string("Une histoire de savoir-faire", "Une histoire de <br> savoir-faire", 'Menu');
|
||||
pll_register_string("Nos solutions au service de nos clients", "Nos solutions au <br> service de nos clients", 'Menu');
|
||||
pll_register_string("Nos marques", "Nos marques", 'Menu');
|
||||
pll_register_string('Actualités', 'Actualités', 'Menu');
|
||||
pll_register_string('Contact', 'Contact', 'Menu');
|
||||
pll_register_string('Nous rejoindre', 'Nous rejoindre', 'Menu');
|
||||
|
||||
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');
|
||||
pll_register_string( "Une histoire de savoir-faire footer", "Une histoire de savoir-faire", 'Footer');
|
||||
pll_register_string( "Nos solutions au service de nos clients footer", "Nos solutions au service de nos clients", 'Footer');
|
||||
pll_register_string( "Tous droits réservés", "Tous droits réservés", 'Footer');
|
||||
pll_register_string( "Tous droits réservés", "Tous droits réservés", 'Footer');
|
||||
pll_register_string( "Mentions légales", "Mentions légales", 'Footer');
|
||||
pll_register_string( "Gestion des cookies", "Gestion des cookies", 'Footer');
|
||||
pll_register_string( "Coordonnées SBV", "Coordonnées SBV", 'Footer');
|
||||
pll_register_string( "Tél :", "Tél :", 'Footer');
|
||||
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');
|
||||
pll_register_string("Une histoire de savoir-faire footer", "Une histoire de savoir-faire", 'Footer');
|
||||
pll_register_string("Nos solutions au service de nos clients footer", "Nos solutions au service de nos clients", 'Footer');
|
||||
pll_register_string("Tous droits réservés", "Tous droits réservés", 'Footer');
|
||||
pll_register_string("Tous droits réservés", "Tous droits réservés", 'Footer');
|
||||
pll_register_string("Mentions légales", "Mentions légales", 'Footer');
|
||||
pll_register_string("Gestion des cookies", "Gestion des cookies", 'Footer');
|
||||
pll_register_string("Coordonnées SBV", "Coordonnées SBV", 'Footer');
|
||||
pll_register_string("Tél :", "Tél :", 'Footer');
|
||||
|
||||
pll_register_string( "Accueil", "Accueil :", 'Actu');
|
||||
pll_register_string( "Nos actualités", "Nos actualités", 'Actu');
|
||||
pll_register_string( "Nos actualités - titre", "Nos Actualités", 'Actu');
|
||||
pll_register_string( "Publiée le", "Publiée le", 'Actu');
|
||||
pll_register_string("Accueil", "Accueil :", 'Actu');
|
||||
pll_register_string("Nos actualités", "Nos actualités", 'Actu');
|
||||
pll_register_string("Nos actualités - titre", "Nos Actualités", 'Actu');
|
||||
pll_register_string("Publiée le", "Publiée le", 'Actu');
|
||||
|
||||
function custom_get_page_link($nameorid){
|
||||
if(!function_exists('pll_the_languages')) return site_url($nameorid);
|
||||
function custom_get_page_link($nameorid)
|
||||
{
|
||||
if(!function_exists('pll_the_languages')) { return site_url($nameorid);
|
||||
}
|
||||
|
||||
$post_id = false;
|
||||
if(is_numeric($nameorid)){
|
||||
$post_id = $nameorid;
|
||||
}else{
|
||||
$post = get_page_by_path($nameorid, OBJECT, array('post','page','dossier','document'));
|
||||
if($post){
|
||||
$post_id = $post->ID;
|
||||
}
|
||||
}
|
||||
if($post_id){
|
||||
$post_id_lang = pll_get_post($post_id);
|
||||
if($post_id_lang){
|
||||
return get_permalink($post_id_lang);
|
||||
}
|
||||
return get_permalink($post_id);
|
||||
}else{
|
||||
return site_url($nameorid);
|
||||
}
|
||||
$post_id = false;
|
||||
if(is_numeric($nameorid)) {
|
||||
$post_id = $nameorid;
|
||||
}else{
|
||||
$post = get_page_by_path($nameorid, OBJECT, array('post','page','dossier','document'));
|
||||
if($post) {
|
||||
$post_id = $post->ID;
|
||||
}
|
||||
}
|
||||
if($post_id) {
|
||||
$post_id_lang = pll_get_post($post_id);
|
||||
if($post_id_lang) {
|
||||
return get_permalink($post_id_lang);
|
||||
}
|
||||
return get_permalink($post_id);
|
||||
}else{
|
||||
return site_url($nameorid);
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'ninja_forms_settings', 'mytheme_ninja_forms_polylang' );
|
||||
function mytheme_ninja_forms_polylang( $settings ) {
|
||||
add_filter('ninja_forms_settings', 'mytheme_ninja_forms_polylang');
|
||||
function mytheme_ninja_forms_polylang( $settings )
|
||||
{
|
||||
$label_settings = array(
|
||||
'date_format',
|
||||
'currency_symbol',
|
||||
|
|
@ -154,17 +162,18 @@ function mytheme_ninja_forms_polylang( $settings ) {
|
|||
'password_mismatch'
|
||||
);
|
||||
foreach ( $label_settings as $label_setting ) {
|
||||
if ( function_exists( 'pll_register_string' ) ) {
|
||||
pll_register_string( $label_setting, $settings[ $label_setting ], 'Ninja Forms' );
|
||||
if (function_exists('pll_register_string') ) {
|
||||
pll_register_string($label_setting, $settings[ $label_setting ], 'Ninja Forms');
|
||||
}
|
||||
add_filter( 'ninja_forms_labels/' . $label_setting, 'mytheme_ninja_forms_translate' );
|
||||
add_filter('ninja_forms_labels/' . $label_setting, 'mytheme_ninja_forms_translate');
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
|
||||
function mytheme_ninja_forms_translate( $label ){
|
||||
if ( function_exists( 'pll__' ) ) {
|
||||
$label = pll__( $label );
|
||||
function mytheme_ninja_forms_translate( $label )
|
||||
{
|
||||
if (function_exists('pll__') ) {
|
||||
$label = pll__($label);
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
|
|
@ -180,36 +189,38 @@ function mytheme_ninja_forms_translate( $label ){
|
|||
SMTP Mail/HTML Mail
|
||||
*******************************************************************/
|
||||
|
||||
add_filter( "wp_mail_content_type", "set_html_content_type" );
|
||||
add_filter("wp_mail_content_type", "set_html_content_type");
|
||||
|
||||
function set_html_content_type() {
|
||||
return "text/html";
|
||||
function set_html_content_type()
|
||||
{
|
||||
return "text/html";
|
||||
}
|
||||
|
||||
add_action( 'phpmailer_init', 'configure_smtp' );
|
||||
function configure_smtp( PHPMailer $phpmailer ){
|
||||
$from_mail = FROM_MAIL;
|
||||
$sender_mail = SENDER_MAIL;
|
||||
$sendername_mail = SENDERNAME_MAIL;
|
||||
add_action('phpmailer_init', 'configure_smtp');
|
||||
function configure_smtp( PHPMailer\PHPMailer\PHPMailer $phpmailer )
|
||||
{
|
||||
$from_mail = FROM_MAIL;
|
||||
$sender_mail = SENDER_MAIL;
|
||||
$sendername_mail = SENDERNAME_MAIL;
|
||||
|
||||
$phpmailer->isSMTP(); //switch to smtp
|
||||
$phpmailer->Host = SMTP_HOST;
|
||||
$phpmailer->SMTPAuth = false;
|
||||
$phpmailer->Port = SMTP_PORT;
|
||||
$phpmailer->Username = '';
|
||||
$phpmailer->Password = '';
|
||||
$phpmailer->SMTPSecure = false;
|
||||
$phpmailer->From = $from_mail;
|
||||
$phpmailer->FromName= $sendername_mail;
|
||||
$phpmailer->Sender= $sender_mail;
|
||||
$phpmailer->SMTPAutoTLS = false;
|
||||
$phpmailer->SMTPOptions = array(
|
||||
'ssl' => array(
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
)
|
||||
);
|
||||
$phpmailer->isSMTP(); //switch to smtp
|
||||
$phpmailer->Host = SMTP_HOST;
|
||||
$phpmailer->SMTPAuth = SMTP_AUTH;
|
||||
$phpmailer->Port = SMTP_PORT;
|
||||
$phpmailer->Username = SMTP_USER;
|
||||
$phpmailer->Password = SMTP_PASS;
|
||||
$phpmailer->SMTPSecure = SMTP_SECURE;
|
||||
$phpmailer->From = $from_mail;
|
||||
$phpmailer->FromName= $sendername_mail;
|
||||
$phpmailer->Sender= $sender_mail;
|
||||
$phpmailer->SMTPAutoTLS = false;
|
||||
$phpmailer->SMTPOptions = array(
|
||||
'ssl' => array(
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue