Bonjour à tous,
J'ai fait appel à un développeur pour un site wordpress et du développement spécifique a été fait.
Malheuresement elle est partie et il y a un problème dans l'envoie d'email de mon site. J'ai regardé le code et j'ai remarqué qu'à partir de la ligne 90, tout était en commentaire. Cependant quand j'enlève le guilleemnt à la ligne 90, j'ai ce message d'erreur qui apparait “syntax error unexpected < expecting ;”. Je ne sais pas si vous savez comment régler cela?
J'ai copié ci dessous le code :
`<?php
/**
* Plugin Name: Custom CRON
* Description: Nouvelles tâches CRON
* Version: 1.0
*/
if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( ‘customCron’ ) ) :
class customCron {
protected $adminEmail;
public function __construct() {
// cron task
add_action(‘my_cron_task’, array($this, ‘alerteTask’));
// activation du plugin
register_activation_hook(__FILE__, array($this, ‘activation’));
// désactivation du plugin
register_deactivation_hook(__FILE__, array($this, ‘desactivation’));
$this->adminEmail = get_option( ‘admin_email’, ” );
}
public function activation() {
// register cron task
wp_mail( $this->adminEmail, ‘Activation du cron’, ‘Activation du cron’ );
if (!wp_next_scheduled(‘my_cron_task’)) {
wp_schedule_event( time(), ‘daily’, ‘my_cron_task’ );
}
}
public function desactivation() {
// de-register cron task
wp_mail( $this->adminEmail, ‘Désactivation du cron’, ‘Désactivation du cron’ );
if (wp_next_scheduled(‘mp_cron_import’)) {
$timeStamp = wp_next_scheduled(‘my_cron_task’);
wp_unschedule_event( $timeStamp, ‘my_cron_task’);
}
}
public function alerteTask() {
$subscriptions = wcs_get_subscriptions([
‘subscription_status’ => ‘active’
]);
foreach ($subscriptions as $subscription) {
if ($this->checkDate($subscription->get_date(‘next_payment’))) {
$user_email = $subscription->get_user()->user_email;
$next_date = $subscription->get_date(‘next_payment’)->format(‘d/m/Y’);
$title = “Il est temps de renouveler votre abonnement Elysée”;
$body = $this->getEmailTemplate(
$title,
$subscription->get_user()->first_name,
$subscription->get_id(),
$subscription->get_view_order_url(),
$next_date
);
$content_type = function() { return ‘text/html’; };
wp_mail( $user_email, $title, $body );
remove_filter( ‘wp_mail_content_type’, $content_type );
}
}
}
private function checkDate($created_at) {
if (empty($created_at)) {
return false;
}
$created_at = Datetime::createFromFormat(“Y-m-d H:i:s”, $created_at);
$interval = new DateInterval(“P7D”);
$created_at->sub($interval);
$created_at->setTime(0, 0);
$date = new DateTime();
$date->setTime(0, 0);
return ($date == $created_at);
}
function getEmailTemplate($title, $firstName, $subscription_id, $view_url, $next_date) {
//$image = “<p style=”margin-top:0;”><img src=”‘ . esc_url( $img ) . ‘” alt=”Elysée” /></p>”;
$image = “”;
return ‘
<!DOCTYPE html>
<html lang=”fr-FR”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>Elysée</title>
<style type=”text/css”>
body {
padding: 0;
}
#wrapper {
background-color: #fff;
margin: 0;
padding: 70px 0;
-webkit-text-size-adjust: none !important;
width: 100%;
}
#template_container {
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
background-color: #ffffff;
border: 1px solid #3c3c3c;
border-radius: 3px !important;
}
#template_header {
background-color: #faca33;
border-radius: 3px 3px 0 0 !important;
color: #3c3c3c;
border-bottom: 0;
font-weight: bold;
line-height: 100%;
vertical-align: middle;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
}
#template_header h1,
#template_header h1 a {
color: #3c3c3c;
background-color: inherit;
}
#template_header_image img {
margin-left: 0;
margin-right: 0;
}
#template_footer td {
padding: 0;
border-radius: 6px;
}
#template_footer #credit {
border: 0;
color: #3c3c3c;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
font-size: 12px;
line-height: 150%;
text-align: center;
padding: 24px 0;
}
#template_footer #credit p {
margin: 0 0 16px;
}
#body_content {
background-color: #ffffff;
}
#body_content table td {
padding: 48px 48px 32px;
}
#body_content table td td {
padding: 12px;
}
#body_content table td th {
padding: 12px;
}
#body_content td ul.wc-item-meta {
font-size: small;
margin: 1em 0 0;
padding: 0;
list-style: none;
}
#body_content td ul.wc-item-meta li {
margin: 0.5em 0 0;
padding: 0;
}
#body_content td ul.wc-item-meta li p {
margin: 0;
}
#body_content p {
margin: 0 0 16px;
}
#body_content_inner {
color: #3c3c3c;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
font-size: 14px;
line-height: 150%;
text-align: left;
}
.td {
color: #3c3c3c;
border: 1px solid #3c3c3c;
vertical-align: middle;
}
.address {
padding: 12px;
color: #3c3c3c;
border: 1px solid #3c3c3c;
}
.text {
color: #3c3c3c;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
}
.link {
color: #faca33;
}
#header_wrapper {
padding: 36px 48px;
display: block;
}
h1 {
color: #faca33;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
font-size: 30px;
font-weight: 300;
line-height: 150%;
margin: 0;
text-align: left;
text-shadow: 0 1px 0;
}
h2 {
color: #faca33;
display: block;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
font-size: 18px;
font-weight: bold;
line-height: 130%;
margin: 0 0 18px;
text-align: left;
}
h3 {
color: #faca33;
display: block;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
font-size: 16px;
font-weight: bold;
line-height: 130%;
margin: 16px 0 8px;
text-align: left;
}
a {
color: #faca33;
font-weight: normal;
text-decoration: underline;
}
img {
border: none;
display: inline-block;
font-size: 14px;
font-weight: bold;
height: auto;
outline: none;
text-decoration: none;
text-transform: capitalize;
vertical-align: middle;
margin-left: 10px;
max-width: 100%;
height: auto;
}
</style>
</head>
<body marginwidth=”0″ topmargin=”0″ marginheight=”0″ offset=”0″>
<div id=”wrapper” dir=”ltr”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ height=”100%” width=”100%”>
<tr>
<td align=”center” valign=”top”>
<div id=”template_header_image”>
‘.$image.’
</div>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”600″ id=”template_container”>
<tr>
<td align=”center” valign=”top”>
<!– Header –>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”100%” id=”template_header”>
<tr>
<td id=”header_wrapper”>
<h1>’.$title.'</h1>
</td>
</tr>
</table>
<!– End Header –>
</td>
</tr>
<tr>
<td align=”center” valign=”top”>
<!– Body –>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”600″ id=”template_body”>
<tr>
<td valign=”top” id=”body_content”>
<!– Content –>
<table border=”0″ cellpadding=”20″ cellspacing=”0″ width=”100%”>
<tr>
<td valign=”top”>
<div id=”body_content_inner”>
<p>Bonjour ‘.$firstName.’,</p>
<p>Votre abonnement mensuel ‘.$subscription_id.’ se termine le ‘.$next_date.’.</p>
<p>Vous avez dorénavant la possibilité de :</p>
<li>Nous restituer l’ensemble des vêtements que vous avez loués et en louer 5, 10 ou 20 nouveaux en suivant ce lien : <a href=”‘.$view_url.'”>’.$view_url.'</a></li>
<li>Conserver les vêtements de votre abonnement actuel, dans ce cas vous n’avez rien a faire, le renouvellement de votre abonnement se fera automatiquement le ‘.$next_date.’ pour une nouvelle période de 30 jours</li>
<li>Nous restituer l’ensemble des vêtements que vous avez loués sans en louer d’autres. Dans ce cas, nous vous demandons de nous restituer les vêtements d’ici le ‘.$next_date.’, sinon vous serez prélevé d’un mois supplémentaire. Voici le lien à suivre pour nous restituer les vêtements : <a href=”‘.$view_url.'”>’.$view_url.'</a></li>
</ul>
<p>L’équipe de Elysée »</p>
<p>…</p>
</div>
</td>
</tr>
</table>
<!– End Content –>
</td>
</tr>
</table>
<!– End Body –>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=”center” valign=”top”>
<!– Footer –>
<table border=”0″ cellpadding=”10″ cellspacing=”0″ width=”600″ id=”template_footer”>
<tr>
<td valign=”top”>
<table border=”0″ cellpadding=”10″ cellspacing=”0″ width=”100%”>
<tr>
<td colspan=”2″ valign=”middle” id=”credit”>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!– End Footer –>
</td>
</tr>
</table>
</div>
</body>
</html>’;
}
}
new customCron;
endif;`
Merci beaucoup pour votre aide

!