Change style of links in text/plain emails
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 3 Aug 2016 16:39:27 +0000 (18:39 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 3 Aug 2016 16:39:54 +0000 (18:39 +0200)
wcfsetup/install/files/lib/system/email/mime/RecipientAwareTextMimePart.class.php

index fd395a591289f763d5926a0caad7d5d6cd5b0bfd..f75e2e5c1ae9be9fd7ec3266caf1d324b0ef279f 100644 (file)
@@ -81,22 +81,7 @@ class RecipientAwareTextMimePart extends TextMimePart implements IRecipientAware
                                $result = $emogrifier->emogrify();
                        }
                        else if ($this->mimeType === 'text/plain') {
-                               $counter = 1;
-                               $urls = [];
-                               $result = preg_replace_callback('~\[URL:(https?://[^\]\s]*)\]~', function ($matches) use (&$counter, &$urls) {
-                                       if (!isset($urls[$matches[1]])) {
-                                               $urls[$matches[1]] = $counter++;
-                                       }
-                                       
-                                       return '['.$urls[$matches[1]].']';
-                               }, $result);
-                               $result = preg_replace_callback('/(?:\r?\n)*(\r?\n-- \r?\n|$)/', function ($matches) use ($urls) {
-                                       $list = "\r\n";
-                                       foreach ($urls as $url => $number) {
-                                               $list .= "\r\n[".$number."] ".$url;
-                                       }
-                                       return $list."\r\n".$matches[1];
-                               }, $result, 1);
+                               $result = preg_replace('~\[URL:(https?://[^\]\s]*)\]~', '<\\1>', $result);
                        }
                        
                        return $result;