getSubjectMessage()->parse();
$intro = $model->getHeaderMessage()->parse();
$bodyMsg = $model->getBodyMessage();
$summary = $bodyMsg ? $bodyMsg->parse() : '';
$actions = array();
$primaryLink = $model->getPrimaryLink();
if ( $primaryLink ) {
$actions[] = $this->renderLink( $primaryLink, self::PRIMARY_LINK_STYLE );
}
foreach ( array_filter( $model->getSecondaryLinks() ) as $secondaryLink ) {
$actions[] = $this->renderLink( $secondaryLink, self::SECONDARY_LINK_STYLE );
}
$iconUrl = EchoNotificationFormatter::getIconUrl( $model->getIconType(), $this->language->getDir() );
$body = $this->renderBody(
$this->language,
$iconUrl,
$summary,
implode( " ", $actions ),
$intro,
$this->getFooter()
);
return array(
'body' => $body,
'subject' => $subject,
);
}
private function renderBody( Language $lang, $emailIcon, $summary, $action, $intro, $footer ) {
$alignStart = $lang->alignStart();
$langCode = $lang->getCode();
$langDir = $lang->getDir();
$iconImgSrc = Sanitizer::encodeAttribute( $emailIcon );
return <<< EOF
|
|
|
|
|
|
{$intro} |
|
|
|
|
|
|
|
|
{$footer}
|
|
|
|
EOF;
}
/**
* @return string
*/
public function getFooter() {
global $wgEchoEmailFooterAddress;
$prefsUrl = SpecialPage::getTitleFor( 'Preferences', false, 'mw-prefsection-echo' )
->getFullURL( '', false, PROTO_CANONICAL );
return $this->msg( 'echo-email-html-footer' )
->params( $wgEchoEmailFooterAddress, $prefsUrl )
->parse();
}
private function renderLink( $link, $style ) {
return Html::element(
'a',
array(
'href' => $link['url'],
'style' => $style,
),
$link['label']
);
}
}