Galorefitz has uploaded a new change for review. https://gerrit.wikimedia.org/r/291922
Change subject: EmailNotification.php: Method for basic html transformations to emails ...................................................................... EmailNotification.php: Method for basic html transformations to emails A method to perform basic HTML transformations to the body of emails, to send them in HTML format. Transformations performed: * Newlines to <br/> tags * Links converted into <a> tags * Enclose the email in <html> and <body> tags Bug: T135484 Change-Id: I6178aadc0b5e0d544ca2c2734ed35f1ee64f62f8 --- M includes/mail/EmailNotification.php M includes/mail/UserMailer.php 2 files changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/22/291922/1 diff --git a/includes/mail/EmailNotification.php b/includes/mail/EmailNotification.php index 1d0bdf6..0821a2d 100644 --- a/includes/mail/EmailNotification.php +++ b/includes/mail/EmailNotification.php @@ -509,4 +509,16 @@ ] ); } + public static function transformContentToHTML ( $content ){ + $body['text'] = $content; + $content = htmlspecialchars( $content ); + $pattern = '/(' . wfUrlProtocols() . ')[^\s\'\"]+/'; + $replace = '<a href="$0">$0</a>'; + $content = preg_replace($pattern, $replace, $content); + $content = nl2br( $content ); + $content = "<html><body>" . $content . "</body></html>"; + $body['html'] = $content; + return $body; + } + } diff --git a/includes/mail/UserMailer.php b/includes/mail/UserMailer.php index 1059d7b..4369736 100644 --- a/includes/mail/UserMailer.php +++ b/includes/mail/UserMailer.php @@ -190,7 +190,7 @@ } /** - * Helper function fo UserMailer::send() which does the actual sending. It expects a $to + * Helper function of UserMailer::send() which does the actual sending. It expects a $to * list which the UserMailerSplitTo hook would not split further. * @param MailAddress[] $to Array of recipients' email addresses * @param MailAddress $from Sender's email -- To view, visit https://gerrit.wikimedia.org/r/291922 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6178aadc0b5e0d544ca2c2734ed35f1ee64f62f8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Galorefitz <smritis.31...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits