| 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 | * @deprecated 6.1 use `ICommentPermissionManager::canModerateObject()` instead |
| 72 | */ |
| 73 | public function canModerate($objectTypeID, $objectID); |
| 74 | |
| 75 | /** |
| 76 | * Returns the amount of comments per page. |
| 77 | * |
| 78 | * @return int |
| 79 | */ |
| 80 | public function getCommentsPerPage(); |
| 81 | |
| 82 | /** |
| 83 | * Returns a link to the commented object with the given object type id and object id. |
| 84 | * |
| 85 | * @param int $objectTypeID |
| 86 | * @param int $objectID |
| 87 | * @return string |
| 88 | */ |
| 89 | public function getLink($objectTypeID, $objectID); |
| 90 | |
| 91 | /** |
| 92 | * Returns the link to the given comment. |
| 93 | * |
| 94 | * @param Comment $comment |
| 95 | * @return string |
| 96 | */ |
| 97 | public function getCommentLink(Comment $comment); |
| 98 | |
| 99 | /** |
| 100 | * Returns the link to the given comment response. |
| 101 | * |
| 102 | * @param CommentResponse $response |
| 103 | * @return string |
| 104 | */ |
| 105 | public function getResponseLink(CommentResponse $response); |
| 106 | |
| 107 | /** |
| 108 | * Returns the title for a comment or response. |
| 109 | * |
| 110 | * @param int $objectTypeID |
| 111 | * @param int $objectID |
| 112 | * @param bool $isResponse |
| 113 | * @return string |
| 114 | */ |
| 115 | public function getTitle($objectTypeID, $objectID, $isResponse = false); |
| 116 | |
| 117 | /** |
| 118 | * Returns true if comments and responses for given object id are accessible |
| 119 | * by current user. |
| 120 | * |
| 121 | * @param int $objectID |
| 122 | * @param bool $validateWritePermission |
| 123 | * @return bool |
| 124 | */ |
| 125 | public function isAccessible($objectID, $validateWritePermission = false); |
| 126 | |
| 127 | /** |
| 128 | * Updates total count of comments (includes responses). |
| 129 | * |
| 130 | * @param int $objectID |
| 131 | * @param int $value |
| 132 | */ |
| 133 | public function updateCounter($objectID, $value); |
| 134 | |
| 135 | /** |
| 136 | * Returns true if this comment type supports likes. |
| 137 | * |
| 138 | * @return bool |
| 139 | */ |
| 140 | public function supportsLike(); |
| 141 | |
| 142 | /** |
| 143 | * Returns true if this comment type supports reports. |
| 144 | * |
| 145 | * @return bool |
| 146 | */ |
| 147 | public function supportsReport(); |
| 148 | |
| 149 | /** |
| 150 | * Sets the list of disallowed bbcodes. |
| 151 | */ |
| 152 | public function setDisallowedBBCodes(); |
| 153 | |
| 154 | /** |
| 155 | * Returns whether the given Comment or CommentResponse was created by |
| 156 | * the content's author. |
| 157 | * |
| 158 | * @param Comment|CommentResponse $commentOrResponse |
| 159 | * @return bool |
| 160 | */ |
| 161 | public function isContentAuthor($commentOrResponse); |
| 162 | } |