소스 검색

Allow templating of email subjects

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v13.0.0beta1
Joas Schilling 6 년 전
부모
커밋
f109c1a10c
No account linked to committer's email address
2개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 20
    0
      lib/private/Mail/EMailTemplate.php
  2. 18
    0
      lib/public/Mail/IEMailTemplate.php

+ 20
- 0
lib/private/Mail/EMailTemplate.php 파일 보기

@@ -50,6 +50,8 @@ class EMailTemplate implements IEMailTemplate {
/** @var array */
protected $data;

/** @var string */
protected $subject = '';
/** @var string */
protected $htmlBody = '';
/** @var string */
@@ -358,6 +360,15 @@ EOF;
$this->data = $data;
}

/**
* Sets the subject of the email
*
* @param string $subject
*/
public function setSubject($subject) {
$this->subject = $subject;
}

/**
* Adds a header to the email
*/
@@ -595,6 +606,15 @@ EOF;
$this->plainBody .= str_replace('<br>', PHP_EOL, $text);
}

/**
* Returns the rendered email subject as string
*
* @return string
*/
public function renderSubject() {
return $this->subject;
}

/**
* Returns the rendered HTML email as string
*

+ 18
- 0
lib/public/Mail/IEMailTemplate.php 파일 보기

@@ -52,6 +52,15 @@ namespace OCP\Mail;
*/
interface IEMailTemplate {

/**
* Sets the subject of the email
*
* @param string $subject
*
* @since 13.0.0
*/
public function setSubject($subject);

/**
* Adds a header to the email
*
@@ -130,6 +139,15 @@ interface IEMailTemplate {
*/
public function addFooter($text = '');

/**
* Returns the rendered email subject as string
*
* @return string
*
* @since 13.0.0
*/
public function renderSubject();

/**
* Returns the rendered HTML email as string
*

Loading…
취소
저장