X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;f=wcfsetup%2Finstall%2Ffiles%2Flib%2Fsystem%2Fuser%2Fnotification%2Fevent%2FArticleUserNotificationEvent.class.php;h=922b1134c94270b6500d90d0a02e025f6975e7a6;hb=783ba164123fefc499b6eba3ae62eb11bba44225;hp=f96cf4f74b6048fc39c903ade8f9e7b6228d8de5;hpb=666311a61ee0e11651e6cb3e188589c10f2f6bc8;p=GitHub%2FWoltLab%2FWCF.git diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ArticleUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ArticleUserNotificationEvent.class.php index f96cf4f74b..922b1134c9 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ArticleUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ArticleUserNotificationEvent.class.php @@ -1,6 +1,7 @@ - * @package WoltLabSuite\Core\System\User\Notification\Object\Type + * @author Joshua Ruesweg + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @package WoltLabSuite\Core\System\User\Notification\Object\Type * - * @method ArticleUserNotificationObject getUserNotificationObject() + * @method ArticleUserNotificationObject getUserNotificationObject() */ -class ArticleUserNotificationEvent extends AbstractUserNotificationEvent implements ITestableUserNotificationEvent { - use TTestableUserNotificationEvent; - use TTestableArticleUserNotificationEvent; - use TTestableCategorizedUserNotificationEvent; - - /** - * @inheritDoc - */ - public function getTitle() { - return $this->getLanguage()->get('wcf.user.notification.article.title'); - } - - /** - * @inheritDoc - */ - public function getMessage() { - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.article.message', [ - 'article' => $this->userNotificationObject, - 'author' => $this->author - ]); - } - - /** - * @inheritDoc - */ - public function getEmailMessage($notificationType = 'instant') { - if ($this->getUserNotificationObject()->isMultilingual) { - $articleContent = $this->getUserNotificationObject()->getArticleContents()[$this->getLanguage()->languageID]; - } - else { - $articleContent = $this->getUserNotificationObject()->getArticleContents()[0]; - } - - return [ - 'message-id' => 'com.woltlab.wcf.article/'.$this->getUserNotificationObject()->articleID, - 'template' => 'email_notification_article', - 'application' => 'wcf', - 'variables' => [ - 'article' => $this->getUserNotificationObject(), - 'articleContent' => $articleContent, - 'languageVariablePrefix' => 'wcf.user.notification.article' - ] - ]; - } - - /** - * @inheritDoc - */ - public function getLink() { - return $this->getUserNotificationObject()->getLink(); - } - - /** - * @inheritDoc - */ - public function checkAccess() { - return $this->getUserNotificationObject()->canRead(); - } - - /** - * @inheritDoc - */ - public static function canBeTriggeredByGuests() { - return true; - } - - /** - * @inheritDoc - * @return Article[] - */ - public static function getTestObjects(UserProfile $recipient, UserProfile $author) { - return [new ArticleUserNotificationObject(self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author))]; - } +class ArticleUserNotificationEvent extends AbstractUserNotificationEvent implements ITestableUserNotificationEvent +{ + use TTestableUserNotificationEvent; + use TTestableArticleUserNotificationEvent; + use TTestableCategorizedUserNotificationEvent; + + /** + * @inheritDoc + */ + public function getTitle() + { + return $this->getLanguage()->get('wcf.user.notification.article.title'); + } + + /** + * @inheritDoc + */ + public function getMessage() + { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.article.message', [ + 'article' => $this->userNotificationObject, + 'author' => $this->author, + ]); + } + + /** + * @inheritDoc + */ + public function getEmailMessage($notificationType = 'instant') + { + if ($this->getUserNotificationObject()->isMultilingual) { + $articleContent = $this->getUserNotificationObject() + ->getArticleContents()[$this->getLanguage()->languageID]; + } else { + $articleContent = $this->getUserNotificationObject() + ->getArticleContents()[0]; + } + + return [ + 'message-id' => 'com.woltlab.wcf.article/' . $this->getUserNotificationObject()->articleID, + 'template' => 'email_notification_article', + 'application' => 'wcf', + 'variables' => [ + 'article' => $this->getUserNotificationObject(), + 'articleContent' => $articleContent, + 'languageVariablePrefix' => 'wcf.user.notification.article', + 'author' => $this->author, + ], + ]; + } + + /** + * @inheritDoc + */ + public function getLink() + { + return $this->getUserNotificationObject()->getLink(); + } + + /** + * @inheritDoc + */ + public function checkAccess() + { + return $this->getUserNotificationObject()->canRead(); + } + + /** + * @inheritDoc + */ + public static function canBeTriggeredByGuests() + { + return true; + } + + /** + * @inheritDoc + * @return ArticleUserNotificationObject[] + */ + public static function getTestObjects(UserProfile $recipient, UserProfile $author) + { + return [ + new ArticleUserNotificationObject( + self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author) + ), + ]; + } }