Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe MailTemplate

Fonctions membres publiques

 __construct ($templateId, $language, Mail $mailer=null)
 
 addAttachment ($name, $file)
 
 addRecipient ($mail, $name=null, $type='to')
 
 setReplyTo ($mail, $name='')
 
 addTemplateData ($data)
 

Fonctions membres publiques statiques

static getTemplate ($key, $language)
 
static createTemplate ($key, $subject, $body, $tags, $htmlbody='')
 
static updateTemplate ($key, $subject, $body, $tags, $htmlbody='')
 
static deleteTemplate ($key)
 

Fonctions membres protégées

 replaceTags ($text, $tags)
 
 getAttachmentName (string $file, string $name)
 

Attributs protégés

 $mailer
 
 $template_id
 
 $language
 
 $data = array()
 
 $attachments = array()
 
 $recipients = array()
 
 $replyto
 

Description détaillée

Email Templating Class

Depuis
4.0.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $templateId,
  $language,
Mail  $mailer = null 
)

Constructor for the mail templating class

Paramètres
string$templateIdId of the mail template.
string$languageLanguage of the template to use.
Mail$mailerMail object to send the mail with.
Depuis
4.0.0

Références PHPMailer\$language, Factory\getMailer(), et language.

Documentation des fonctions membres

◆ addAttachment()

addAttachment (   $name,
  $file 
)

Add an attachment to the mail

Paramètres
string$nameFilename of the attachment
string$fileEither a filepath or filecontent
Renvoie
void
Depuis
4.0.0

Références PHPMailer\$attachment, et $name.

◆ addRecipient()

addRecipient (   $mail,
  $name = null,
  $type = 'to' 
)

Adds recipients for this mail

Paramètres
string$mailMail address of the recipient
string$nameName of the recipient
string$typeHow should the recipient receive the mail? ('to', 'cc', 'bcc')
Renvoie
void
Depuis
4.0.0

Références $name, et $type.

Référencé par ContactController\_sendEmail(), et Email\sendCode().

◆ addTemplateData()

addTemplateData (   $data)

Add data to replace in the template

Paramètres
array$dataAssociative array of strings to replace
Renvoie
void
Depuis
4.0.0

Références $data.

Référencé par RegistrationModel\activate(), RemindModel\processRemindRequest(), ResetModel\processResetRequest(), RegistrationModel\register(), PlgSystemPrivacyconsent\remindExpiringConsents(), et ActionlogModel\sendNotificationEmails().

◆ createTemplate()

static createTemplate (   $key,
  $subject,
  $body,
  $tags,
  $htmlbody = '' 
)
static

Insert a new mail template into the system

Paramètres
string$keyMail template key
string$subjectA default subject (normally a translatable string)
string$bodyA default body (normally a translatable string)
array$tagsAssociative array of tags to replace
string$htmlbodyA default htmlbody (normally a translatable string)
Renvoie
boolean True on success, false on failure
Depuis
4.0.0

Références $db, $key, $params, $subject, $template, et Factory\getDbo().

◆ deleteTemplate()

static deleteTemplate (   $key)
static

Method to delete a mail template

Paramètres
string$keyThe key of the mail template
Renvoie
boolean True on success, false on failure
Depuis
4.0.0

Références $db, $key, $query, et Factory\getDbo().

◆ getAttachmentName()

getAttachmentName ( string  $file,
string  $name 
)
protected

Check and if necessary fix the file name of an attachment so that the attached file has the same extension as the source file, and not a different file extension

Paramètres
string$filePath to the file to be attached
string$nameThe file name to be used for the attachment
Renvoie
string The corrected file name for the attachment
Depuis
4.0.0

Références $name, File\getExt(), et File\stripExt().

◆ getTemplate()

static getTemplate (   $key,
  $language 
)
static

Get a specific mail template

Paramètres
string$keyTemplate identifier
string$languageLanguage code of the template
Renvoie
object|null An object with the data of the mail, or null if the template not found in the db.
Depuis
4.0.0

Références $db, $key, PHPMailer\$language, $query, Factory\getDbo(), et ParameterType\STRING.

◆ replaceTags()

replaceTags (   $text,
  $tags 
)
protected

Replace tags with their values recursively

Paramètres
string$textThe template to process
array$tagsAn associative array to replace in the template
Renvoie
string Rendered mail template
Depuis
4.0.0

Références $i, $key, $text, et $value.

◆ setReplyTo()

setReplyTo (   $mail,
  $name = '' 
)

Set reply to for this mail

Paramètres
string$mailMail address to reply to
string$nameName
Renvoie
void
Depuis
4.0.0

Références $name.

◆ updateTemplate()

static updateTemplate (   $key,
  $subject,
  $body,
  $tags,
  $htmlbody = '' 
)
static

Update an existing mail template

Paramètres
string$keyMail template key
string$subjectA default subject (normally a translatable string)
string$bodyA default body (normally a translatable string)
array$tagsAssociative array of tags to replace
string$htmlbodyA default htmlbody (normally a translatable string)
Renvoie
boolean True on success, false on failure
Depuis
4.0.0

Références $db, $key, $params, $subject, $template, et Factory\getDbo().

Documentation des champs

◆ $attachments

$attachments = array()
protected

◆ $data

$data = array()
protected

◆ $language

$language
protected

◆ $mailer

$mailer
protected

◆ $recipients

$recipients = array()
protected

◆ $replyto

$replyto
protected

◆ $template_id

$template_id
protected

La documentation de cette classe a été générée à partir du fichier suivant :