Replace str_replace with strtr
authorMatthias Schmidt <gravatronics@live.com>
Mon, 14 Mar 2016 17:06:16 +0000 (18:06 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 14 Mar 2016 17:06:16 +0000 (18:06 +0100)
wcfsetup/install/files/lib/data/notice/Notice.class.php

index a950eabff26358fe9fd5f1bf0f563adbba20cd90..5e54388938f53a76ba2ac068bb92626cd7c489d5 100644 (file)
@@ -41,8 +41,12 @@ class Notice extends DatabaseObject implements IRouteController {
         * @since       2.2
         */
        public function __toString() {
-               // replace `{$username}` with the active user's name and the `{$email}` with the active users' email address
-               $text = str_replace(['{$username}', '{$email}'], [WCF::getUser()->username, WCF::getUser()->email], WCF::getLanguage()->get($this->notice));
+               // replace `{$username}` with the active user's name and `{$email}`
+               // with the active user's email address
+               $text = strtr(WCF::getLanguage()->get($this->notice), [
+                       '{$username}' => WCF::getUser()->username,
+                       '{$email}' => WCF::getUser()->email
+               ]);
                
                if (!$this->noticeUseHtml) {
                        $text = nl2br(htmlspecialchars($text));