Added event support in `UserOnline::getBrowser()`
authorAlexander Ebert <ebert@woltlab.com>
Wed, 6 Sep 2017 12:37:58 +0000 (14:37 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 6 Sep 2017 12:37:58 +0000 (14:37 +0200)
wcfsetup/install/files/lib/data/user/online/UserOnline.class.php

index c14588f5f89185602edbde278c4b5c3e9c66b557..43f6070f90b4518d228e7c605542e7de31684419 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\page\PageCache;
 use wcf\data\spider\Spider;
 use wcf\data\user\UserProfile;
 use wcf\system\cache\builder\SpiderCacheBuilder;
+use wcf\system\event\EventHandler;
 use wcf\system\page\handler\IOnlineLocationPageHandler;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
@@ -124,6 +125,12 @@ class UserOnline extends UserProfile {
         * @return      string
         */
        public function getBrowser() {
+               $parameters = ['browser' => '', 'userAgent' => $this->userAgent];
+               EventHandler::getInstance()->fireAction($this, 'getBrowser', $parameters);
+               if (!empty($parameters['browser'])) {
+                       return $parameters['browser'];
+               }
+               
                // lunascape
                if (preg_match('~lunascape[ /]([\d\.]+)~i', $this->userAgent, $match)) {
                        return 'Lunascape '.$match[1];