mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-01-22 17:19:49 +00:00
pass translator to constructor
This commit is contained in:
parent
8a6db445c5
commit
cc34c42f73
|
|
@ -36,6 +36,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
*/
|
||||
protected $_dms;
|
||||
|
||||
protected $_translator;
|
||||
|
||||
protected $smtp_server;
|
||||
|
||||
protected $smtp_port;
|
||||
|
|
@ -52,8 +54,9 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
|
||||
protected $debug;
|
||||
|
||||
function __construct($dms, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true, $force_from=false) { /* {{{ */
|
||||
function __construct($dms, $translator, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true, $force_from=false) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
$this->_translator = $translator;
|
||||
$this->smtp_server = $smtp_server;
|
||||
$this->smtp_port = $smtp_port;
|
||||
$this->smtp_user = $smtp_username;
|
||||
|
|
@ -126,38 +129,38 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
$body = '';
|
||||
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
|
||||
if(!isset($params['__header__']))
|
||||
$body .= getMLText("email_header", $params, "", $lang)."\r\n\r\n";
|
||||
$body .= $this->_translator->translate("email_header", $params, "", $lang)."\r\n\r\n";
|
||||
elseif($params['__header__'])
|
||||
$body .= getMLText($params['__header__'], $params, "", $lang)."\r\n\r\n";
|
||||
$body .= $this->_translator->translate($params['__header__'], $params, "", $lang)."\r\n\r\n";
|
||||
}
|
||||
if(isset($params['__body__']))
|
||||
$body .= $params['__body__'];
|
||||
else
|
||||
$body .= getMLText($messagekey, $params, "", $lang);
|
||||
$body .= $this->_translator->translate($messagekey, $params, "", $lang);
|
||||
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
|
||||
if(!isset($params['__footer__']))
|
||||
$body .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang);
|
||||
$body .= "\r\n\r\n".$this->_translator->translate("email_footer", $params, "", $lang);
|
||||
elseif($params['__footer__'])
|
||||
$body .= "\r\n\r\n".getMLText($params['__footer__'], $params, "", $lang);
|
||||
$body .= "\r\n\r\n".$this->_translator->translate($params['__footer__'], $params, "", $lang);
|
||||
}
|
||||
|
||||
$bodyhtml = '';
|
||||
if(isset($params['__body_html__']) || getMLText($messagekey.'_html', $params, "", $lang)) {
|
||||
if(isset($params['__body_html__']) || $this->_translator->translate($messagekey.'_html', $params, "", $lang)) {
|
||||
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
|
||||
if(!isset($params['__header_html__']))
|
||||
$bodyhtml .= getMLText("email_header_html", $params, "", $lang)."\r\n\r\n";
|
||||
$bodyhtml .= $this->_translator->translate("email_header_html", $params, "", $lang)."\r\n\r\n";
|
||||
elseif($params['__header_html__'])
|
||||
$bodyhtml .= getMLText($params['__header_html__'], $params, "", $lang)."\r\n\r\n";
|
||||
$bodyhtml .= $this->_translator->translate($params['__header_html__'], $params, "", $lang)."\r\n\r\n";
|
||||
}
|
||||
if(isset($params['__body_html__']))
|
||||
$bodyhtml .= $params['__body_html__'];
|
||||
else
|
||||
$bodyhtml .= getMLText($messagekey.'_html', $params, "", $lang);
|
||||
$bodyhtml .= $this->_translator->translate($messagekey.'_html', $params, "", $lang);
|
||||
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
|
||||
if(!isset($params['__footer_html__']))
|
||||
$bodyhtml .= "\r\n\r\n".getMLText("email_footer_html", $params, "", $lang);
|
||||
$bodyhtml .= "\r\n\r\n".$this->_translator->translate("email_footer_html", $params, "", $lang);
|
||||
elseif($params['__footer_html__'])
|
||||
$bodyhtml .= "\r\n\r\n".getMLText($params['__footer_html__'], $params, "", $lang);
|
||||
$bodyhtml .= "\r\n\r\n".$this->_translator->translate($params['__footer_html__'], $params, "", $lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +210,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
$headers['Return-Path'] = $returnpath;
|
||||
$headers['To'] = $to;
|
||||
$preferences = array("input-charset" => "UTF-8", "output-charset" => "UTF-8", "scheme"=>"Q");
|
||||
$encoded_subject = iconv_mime_encode("Subject", getMLText($subject, $params, null, $lang), $preferences);
|
||||
$encoded_subject = iconv_mime_encode("Subject", $this->_translator->translate($subject, $params, null, $lang), $preferences);
|
||||
$headers['Subject'] = substr($encoded_subject, strlen('Subject: '));
|
||||
$headers['Date'] = date('r', time());
|
||||
$headers['MIME-Version'] = "1.0";
|
||||
|
|
@ -240,7 +243,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
if (isset($GLOBALS['SEEDDMS_HOOKS']['mailqueue'])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['mailqueue'] as $queueService) {
|
||||
if(method_exists($queueService, 'queueMailJob')) {
|
||||
$ret = $queueService->queueMailJob($mail_params, $to, $hdrs, getMLText($subject, $params, "", $lang), $message);
|
||||
$ret = $queueService->queueMailJob($mail_params, $to, $hdrs, $this->_translator->translate($subject, $params, "", $lang), $message);
|
||||
if($ret !== null)
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user