function SimplenewsSourceEntity::getSubject in Simplenews 7.2
Implements SimplenewsSourceInterface::getSubject().
Overrides SimplenewsSourceInterface::getSubject
File
- includes/
simplenews.source.inc, line 569 - Contains SimplenewsSource interface and implementations.
Class
- SimplenewsSourceEntity
- Default source class for entities.
Code
function getSubject() {
// Build email subject and perform some sanitizing.
$langcode = $this
->getLanguage();
$language_list = language_list();
// Use the requested language if enabled.
$language = isset($language_list[$langcode]) ? $language_list[$langcode] : NULL;
$subject = token_replace($this
->getNewsletter()->email_subject, $this
->getTokenContext(), array(
'sanitize' => FALSE,
'language' => $language,
));
// Line breaks are removed from the email subject to prevent injection of
// malicious data into the email header.
$subject = str_replace(array(
"\r",
"\n",
), '', $subject);
return $subject;
}