CommentsUtil Class Reference

Static Public Member Functions

static sendNotificationOnCommentCreateOrUpdate (RedBeanModel $relatedModel, Comment $comment, $peopleToSendNotification)
static getUrlToEmail ($model)
static getMentionedUsersForNotification (Comment $comment)
static replaceMentionedUsernamesWithFullNamesAndLinksInComments ($commentDescription)
static resolveMarkdownTagsAndConvertToHtml ($description, $type)
static hasUserHaveAccessToEditOrDeleteComment (Comment $comment, User $user)

Static Protected Member Functions

static createNotificationMessage ($model, Comment $comment)
static resolveOnNewCommentNotificationSettingNameByModel (RedBeanModel $model)
static resolveNotificationRulesClassByModel (RedBeanModel $model)

Detailed Description

Helper class for working with comments

Definition at line 42 of file CommentsUtil.php.


Member Function Documentation

static sendNotificationOnCommentCreateOrUpdate ( RedBeanModel relatedModel,
Comment comment,
peopleToSendNotification 
) [static]
Parameters:
RedBeanModel $relatedModel
Comment $comment
array $peopleToSendNotification

Definition at line 49 of file CommentsUtil.php.

static getUrlToEmail ( model  )  [static]
Parameters:
$model 
Returns:
mixed

Definition at line 73 of file CommentsUtil.php.

static createNotificationMessage ( model,
Comment comment 
) [static, protected]

Creates notification message for new comment

Parameters:
$model 
Comment $comment
Returns:
NotificationMessage

Definition at line 95 of file CommentsUtil.php.

static getMentionedUsersForNotification ( Comment comment  )  [static]

Parse comments and extract all username between '[~' and ']' For example if we have string: "Hello [~john]"

Parameters:
Comment $comment
Returns:
array

Definition at line 137 of file CommentsUtil.php.

static replaceMentionedUsernamesWithFullNamesAndLinksInComments ( commentDescription  )  [static]

Parse comments and extract all username between '[~' and ']' For example if we have string: "Hello [~john]", after replacement, it will be: Hello John Smith

Parameters:
string $commentDescription
Returns:
array

Definition at line 170 of file CommentsUtil.php.

static resolveOnNewCommentNotificationSettingNameByModel ( RedBeanModel model  )  [static, protected]

Resolve the notification setting name by model

Returns:
string

Definition at line 216 of file CommentsUtil.php.

static resolveNotificationRulesClassByModel ( RedBeanModel model  )  [static, protected]

Resolve the notification rules class name by model

Returns:
string

Definition at line 225 of file CommentsUtil.php.

static hasUserHaveAccessToEditOrDeleteComment ( Comment comment,
User user 
) [static]

Check if user should have access to comment edit and delete comments Only user who created comment and super administrators should have access to these actions

Parameters:
Comment $comment
User $user
Returns:
bool
Exceptions:
NotFoundException 

Definition at line 238 of file CommentsUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Tue Oct 15 07:11:01 2019