Merge branch '5.5'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / comment / manager / ICommentManager.class.php
1 <?php
2
3 namespace wcf\system\comment\manager;
4
5 use wcf\data\comment\Comment;
6 use wcf\data\comment\response\CommentResponse;
7
8 /**
9 * Default interface for comment managers.
10 *
11 * @author Alexander Ebert
12 * @copyright 2001-2019 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 */
15 interface ICommentManager
16 {
17 /**
18 * Returns true if the current user may add comments or responses.
19 *
20 * @param int $objectID
21 * @return bool
22 */
23 public function canAdd($objectID);
24
25 /**
26 * Returns true if a comment requires approval.
27 *
28 * @param int $objectID
29 * @return bool
30 */
31 public function canAddWithoutApproval($objectID);
32
33 /**
34 * Returns true if the current user may edit given comment.
35 *
36 * @param Comment $comment
37 * @return bool
38 */
39 public function canEditComment(Comment $comment);
40
41 /**
42 * Returns true if the current user may edit given response.
43 *
44 * @param CommentResponse $response
45 * @return bool
46 */
47 public function canEditResponse(CommentResponse $response);
48
49 /**
50 * Returns true if the current user may delete given comment.
51 *
52 * @param Comment $comment
53 * @return bool
54 */
55 public function canDeleteComment(Comment $comment);
56
57 /**
58 * Returns true if the current user may delete given response.
59 *
60 * @param CommentResponse $response
61 */
62 public function canDeleteResponse(CommentResponse $response);
63
64 /**
65 * Returns true if the current user may moderated content identified by
66 * object type id and object id.
67 *
68 * @param int $objectTypeID
69 * @param int $objectID
70 * @return bool
71 */
72 public function canModerate($objectTypeID, $objectID);
73
74 /**
75 * Returns the amount of comments per page.
76 *
77 * @return int
78 */
79 public function getCommentsPerPage();
80
81 /**
82 * Returns a link to the commented object with the given object type id and object id.
83 *
84 * @param int $objectTypeID
85 * @param int $objectID
86 * @return string
87 */
88 public function getLink($objectTypeID, $objectID);
89
90 /**
91 * Returns the link to the given comment.
92 *
93 * @param Comment $comment
94 * @return string
95 */
96 public function getCommentLink(Comment $comment);
97
98 /**
99 * Returns the link to the given comment response.
100 *
101 * @param CommentResponse $response
102 * @return string
103 */
104 public function getResponseLink(CommentResponse $response);
105
106 /**
107 * Returns the title for a comment or response.
108 *
109 * @param int $objectTypeID
110 * @param int $objectID
111 * @param bool $isResponse
112 * @return string
113 */
114 public function getTitle($objectTypeID, $objectID, $isResponse = false);
115
116 /**
117 * Returns true if comments and responses for given object id are accessible
118 * by current user.
119 *
120 * @param int $objectID
121 * @param bool $validateWritePermission
122 * @return bool
123 */
124 public function isAccessible($objectID, $validateWritePermission = false);
125
126 /**
127 * Updates total count of comments (includes responses).
128 *
129 * @param int $objectID
130 * @param int $value
131 */
132 public function updateCounter($objectID, $value);
133
134 /**
135 * Returns true if this comment type supports likes.
136 *
137 * @return bool
138 */
139 public function supportsLike();
140
141 /**
142 * Returns true if this comment type supports reports.
143 *
144 * @return bool
145 */
146 public function supportsReport();
147
148 /**
149 * Sets the list of disallowed bbcodes.
150 */
151 public function setDisallowedBBCodes();
152
153 /**
154 * Returns whether the given Comment or CommentResponse was created by
155 * the content's author.
156 *
157 * @param Comment|CommentResponse $commentOrResponse
158 * @return bool
159 */
160 public function isContentAuthor($commentOrResponse);
161 }