Fixed missing smilies in mail notifications
authorMarcel Werk <burntime@woltlab.com>
Mon, 24 Nov 2014 00:45:18 +0000 (01:45 +0100)
committerMarcel Werk <burntime@woltlab.com>
Mon, 24 Nov 2014 00:45:18 +0000 (01:45 +0100)
wcfsetup/install/files/lib/system/bbcode/MessageParser.class.php

index b2ac2e7c26700bc8eff741d4c73bc3503a56abfa..3d1cc9216f8a0533d71014945f2551e5506725fc 100644 (file)
@@ -216,4 +216,23 @@ class MessageParser extends BBCodeParser {
                
                return true;
        }
+       
+       /**
+        * Returns a text-only version of given message.
+        *
+        * @param       string          $message
+        * @return      string
+        */
+       public function stripHTML($message) {
+               // remove img tags (smilies)
+               $message = preg_replace('~<img src="[^"]+" alt="([^"]+)" />~', '\\1', $message);
+               
+               // strip other HTML tags
+               $message = StringUtil::stripHTML($message);
+               
+               // decode HTML entities
+               $message = StringUtil::decodeHTML($message);
+               
+               return $message;
+       }
 }