API CHANGE Email_Template class deprecated, Email should be used from now on.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56144 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-06-12 09:29:05 +00:00
parent 7ec8c205f1
commit b96608e0a3
2 changed files with 28 additions and 26 deletions

View File

@ -67,15 +67,16 @@ class Email extends ViewableData {
/**
* Create a new email.
*/
public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc=null ) {
public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null) {
$this->from = $from;
$this->to = $to;
$this->subject = $subject;
$this->body = $body;
$this->cc = $cc;
$this->bcc = $bcc;
$this->setBounceHandlerURL( $bounceHandlerURL );
$this->setBounceHandlerURL($bounceHandlerURL);
}
public function attachFileFromString($data, $filename, $mimetype = null) {
$this->attachments[] = array(
'contents' => $data,
@ -136,10 +137,25 @@ class Email extends ViewableData {
$this->customHeaders[$headerName] .= $headerValue;
}
}
public function BaseURL() {
return Director::absoluteBaseURL();
}
/**
* Debugging help
*/
public function debug() {
$this->parseVariables();
return "<h2>Email template $this->class</h2>\n" .
"<p><b>From:</b> $this->from\n" .
"<b>To:</b> $this->to\n" .
"<b>Cc:</b> $this->cc\n" .
"<b>Bcc:</b> $this->bcc\n" .
"<b>Subject:</b> $this->subject</p>" .
$this->body;
}
protected function templateData() {
if($this->template_data) {
@ -215,21 +231,6 @@ class Email extends ViewableData {
}
}
/**
* Debugging help
*/
public function debug() {
$this->parseVariables();
return "<h2>Email template $this->class</h2>\n" .
"<p><b>From:</b> $this->from\n" .
"<b>To:</b> $this->to\n" .
"<b>Cc:</b> $this->cc\n" .
"<b>Bcc:</b> $this->bcc\n" .
"<b>Subject:</b> $this->subject</p>" .
$this->body;
}
/**
* @desc Validates the email address. Returns true of false
*/
@ -419,13 +420,14 @@ class Email extends ViewableData {
* @subpackage email
*/
class Email_Template extends Email {
public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null) {
parent::__construct($from, $to, $subject, $body, $bounceHandlerURL, $cc, $bcc);
user_error('Email_Template is deprecated. Please use Email instead.', E_USER_NOTICE);
}
}
/**
* Base class that email bounce handlers extend
* @package sapphire

View File

@ -1253,7 +1253,7 @@ class Member_ProfileForm extends Form {
* @package sapphire
* @subpackage security
*/
class Member_SignupEmail extends Email_Template {
class Member_SignupEmail extends Email {
protected $from = ''; // setting a blank from address uses the site's default administrator email
protected $to = '$Email';
protected $subject = '';
@ -1311,7 +1311,7 @@ class Member_SignupEmail extends Email_Template {
* @package sapphire
* @subpackage security
*/
class Member_ChangePasswordEmail extends Email_Template {
class Member_ChangePasswordEmail extends Email {
protected $from = ''; // setting a blank from address uses the site's default administrator email
protected $subject = '';
protected $ss_template = 'ChangePasswordEmail';
@ -1329,7 +1329,7 @@ class Member_ChangePasswordEmail extends Email_Template {
* @package sapphire
* @subpackage security
*/
class Member_ForgotPasswordEmail extends Email_Template {
class Member_ForgotPasswordEmail extends Email {
protected $from = ''; // setting a blank from address uses the site's default administrator email
protected $subject = '';
protected $ss_template = 'ForgotPasswordEmail';