| Next revision | Previous revision |
| scriptlog:lib:service:commentservice [2026/09/26 09:09] – admin admin | scriptlog:lib:service:commentservice [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Service class | | | ''@category'' | Service class | |
| | ''@author'' | M.Noermoehammad | | | ''@author'' | M.Noermoehammad | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| //None.// | //None.// |
| |
| ======= Properties (0) ======= | ======= Properties (11) ======= |
| |
| //None declared.// | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | | ''private'' | ''(untyped)'' | ''$comment_id'' | | 28 | |
| | | ''private'' | ''(untyped)'' | ''$post_id'' | | 34 | |
| | | ''private'' | ''(untyped)'' | ''$author_name'' | | 40 | |
| | | ''private'' | ''(untyped)'' | ''$author_ip'' | | 46 | |
| | | ''private'' | ''(untyped)'' | ''$author_email'' | | 53 | |
| | | ''private'' | ''(untyped)'' | ''$content'' | | 59 | |
| | | ''private'' | ''(untyped)'' | ''$status'' | | 65 | |
| | | ''private'' | ''(untyped)'' | ''$created_at'' | | 72 | |
| | | ''private'' | ''(untyped)'' | ''$commentDao'' | | 80 | |
| | | ''private'' | ''(untyped)'' | ''$validator'' | | 88 | |
| | | ''private'' | ''(untyped)'' | ''$sanitizer'' | | 95 | |
| |
| ======= Methods (23) ======= | ======= Methods (23) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | (undocumented) | 97 | | | public | ''__construct()'' | (undocumented) | 97 | |
| | public | ''setCommentId()'' | (undocumented) | 104 | | | public | ''setCommentId()'' | (undocumented) | 104 | |
| | public | ''setPostId()'' | (undocumented) | 109 | | | public | ''setPostId()'' | (undocumented) | 109 | |
| | public | ''setAuthorName()'' | (undocumented) | 114 | | | public | ''setAuthorName()'' | (undocumented) | 114 | |
| | public | ''setAuthorIP()'' | (undocumented) | 119 | | | public | ''setAuthorIP()'' | (undocumented) | 119 | |
| | public | ''setAuthorEmail()'' | (undocumented) | 124 | | | public | ''setAuthorEmail()'' | (undocumented) | 124 | |
| | public | ''setCommentContent()'' | (undocumented) | 129 | | | public | ''setCommentContent()'' | (undocumented) | 129 | |
| | public | ''setCommentStatus()'' | (undocumented) | 134 | | | public | ''setCommentStatus()'' | (undocumented) | 134 | |
| | public | ''setCommentDate()'' | (undocumented) | 139 | | | public | ''setCommentDate()'' | (undocumented) | 139 | |
| | public | ''grabComments()'' | (undocumented) | 144 | | | public | ''grabComments()'' | (undocumented) | 144 | |
| | public | ''grabComment()'' | (undocumented) | 149 | | | public | ''grabComment()'' | (undocumented) | 149 | |
| | public | ''getApprovedCommentsApi()'' | Get paginated approved comments for API | 164 | | | public | ''getApprovedCommentsApi()'' | Get paginated approved comments for API | 164 | |
| | public | ''countApprovedCommentsApi()'' | Count approved comments for API | 176 | | | public | ''countApprovedCommentsApi()'' | Count approved comments for API | 176 | |
| | public | ''modifyComment()'' | (undocumented) | 181 | | | public | ''modifyComment()'' | (undocumented) | 181 | |
| | public | ''removeComment()'' | Remove Comment | 197 | | | public | ''removeComment()'' | Remove Comment | 197 | |
| | public | ''commentStatementDropDown()'' | Comment Statement DropDown | 217 | | | public | ''commentStatementDropDown()'' | Comment Statement DropDown | 217 | |
| | public | ''totalComments()'' | Total Comments recorded | 229 | | | public | ''totalComments()'' | Total Comments recorded | 229 | |
| | public | ''countReplies()'' | Count Replies for a Comment | 240 | | | public | ''countReplies()'' | Count Replies for a Comment | 240 | |
| | public | ''getCommentApi()'' | Get a single comment with post info for the API. | 251 | | | public | ''getCommentApi()'' | Get a single comment with post info for the API. | 251 | |
| | public | ''createCommentApi()'' | Create a comment from raw data for the API. | 262 | | | public | ''createCommentApi()'' | Create a comment from raw data for the API. | 262 | |
| | public | ''updateCommentApi()'' | Update a comment with raw data for the API. | 274 | | | public | ''updateCommentApi()'' | Update a comment with raw data for the API. | 274 | |
| | public | ''removeCommentApi()'' | Delete a comment and its replies for the API. | 285 | | | public | ''removeCommentApi()'' | Delete a comment and its replies for the API. | 285 | |
| | public | ''checkPostAcceptsComments()'' | Check if a post exists and allows comments. | 296 | | | public | ''checkPostAcceptsComments()'' | Check if a post exists and allows comments. | 296 | |
| |
| |
| //lines 97–102 (6)// | //lines 97–102 (6)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$commentDao'' | [[scriptlog:lib:dao:commentdao|''CommentDao'']] | //required// | //none// | | | ''$commentDao'' | [[scriptlog:lib:dao:commentdao|''CommentDao'']] | //required// | //none// | |
| | ''$validator'' | [[scriptlog:lib:core:formvalidator|''FormValidator'']] | //required// | //none// | | | ''$validator'' | [[scriptlog:lib:core:formvalidator|''FormValidator'']] | //required// | //none// | |
| | ''$sanitize'' | [[scriptlog:lib:core:sanitize|''Sanitize'']] | //required// | //none// | | | ''$sanitize'' | [[scriptlog:lib:core:sanitize|''Sanitize'']] | //required// | //none// | |
| |
| |
| //lines 104–107 (4)// | //lines 104–107 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$comment_id'' | ''(untyped)'' | //required// | //none// | | | ''$comment_id'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 109–112 (4)// | //lines 109–112 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$post_id'' | ''(untyped)'' | //required// | //none// | | | ''$post_id'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 114–117 (4)// | //lines 114–117 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$author_name'' | ''(untyped)'' | //required// | //none// | | | ''$author_name'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 119–122 (4)// | //lines 119–122 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$author_ip'' | ''(untyped)'' | //required// | //none// | | | ''$author_ip'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 124–127 (4)// | //lines 124–127 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$author_email'' | ''(untyped)'' | //required// | //none// | | | ''$author_email'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 129–132 (4)// | //lines 129–132 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$content'' | ''(untyped)'' | //required// | //none// | | | ''$content'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 134–137 (4)// | //lines 134–137 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$status'' | ''(untyped)'' | //required// | //none// | | | ''$status'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 139–142 (4)// | //lines 139–142 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$created_at'' | ''(untyped)'' | //required// | //none// | | | ''$created_at'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 144–147 (4)// | //lines 144–147 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$orderBy'' | ''(untyped)'' | '''ID''' | //none// | | | ''$orderBy'' | ''(untyped)'' | '''ID''' | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 149–152 (4)// | //lines 149–152 (4)// |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''(untyped)'' | //required// | //none// | | | ''$id'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Get paginated approved comments for API | Get paginated approved comments for API |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$page'' | ''(untyped)'' | ''1'' | //none// | | | ''$page'' | ''(untyped)'' | ''1'' | //none// | |
| | ''$perPage'' | ''(untyped)'' | ''10'' | //none// | | | ''$perPage'' | ''(untyped)'' | ''10'' | //none// | |
| | ''$sortBy'' | ''(untyped)'' | '''ID''' | //none// | | | ''$sortBy'' | ''(untyped)'' | '''ID''' | //none// | |
| | ''$sortOrder'' | ''(untyped)'' | '''DESC''' | //none// | | | ''$sortOrder'' | ''(untyped)'' | '''DESC''' | //none// | |
| | ''$postId'' | ''(untyped)'' | ''null'' | //none// | | | ''$postId'' | ''(untyped)'' | ''null'' | //none// | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| Count approved comments for API | Count approved comments for API |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$postId'' | ''(untyped)'' | ''null'' | //none// | | | ''$postId'' | ''(untyped)'' | ''null'' | //none// | |
| |
| **Returns:** ''(none declared)'' — integer | **Returns:** ''(none declared)'' — integer |
| Comment Statement DropDown | Comment Statement DropDown |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$selected'' | ''(untyped)'' | ''""'' | //none// | | | ''$selected'' | ''(untyped)'' | ''""'' | //none// | |
| |
| **Returns:** ''(none declared)'' — string | **Returns:** ''(none declared)'' — string |
| Total Comments recorded | Total Comments recorded |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$data'' | ''(untyped)'' | ''null'' | //none// | | | ''$data'' | ''(untyped)'' | ''null'' | //none// | |
| |
| **Returns:** ''(none declared)'' — integer | **Returns:** ''(none declared)'' — integer |
| Count Replies for a Comment | Count Replies for a Comment |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$commentId'' | ''(untyped)'' | //required// | //none// | | | ''$commentId'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — int | **Returns:** ''(none declared)'' — int |
| Get a single comment with post info for the API. | Get a single comment with post info for the API. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$commentId'' | ''(untyped)'' | //required// | //none// | | | ''$commentId'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array|false | **Returns:** ''(none declared)'' — array|false |
| Create a comment from raw data for the API. | Create a comment from raw data for the API. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$data'' | ''array'' | //required// | //none// | | | ''$data'' | ''array'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — int | **Returns:** ''(none declared)'' — int |
| Update a comment with raw data for the API. | Update a comment with raw data for the API. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$commentId'' | ''(untyped)'' | //required// | //none// | | | ''$commentId'' | ''(untyped)'' | //required// | //none// | |
| | ''$data'' | ''array'' | //required// | //none// | | | ''$data'' | ''array'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| Delete a comment and its replies for the API. | Delete a comment and its replies for the API. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$commentId'' | ''(untyped)'' | //required// | //none// | | | ''$commentId'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| Check if a post exists and allows comments. | Check if a post exists and allows comments. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$postId'' | ''(untyped)'' | //required// | //none// | | | ''$postId'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — string|null Returns comment_status value or null if post not found | **Returns:** ''(none declared)'' — string|null Returns comment_status value or null if post not found |
| ======= Imports ======= | ======= Imports ======= |
| |
| ^ Alias ^ Fully-qualified name ^ | ^ Alias ^ Fully-qualified name ^ |
| | ''FormValidator'' | [[scriptlog:lib:core:formvalidator|''Scriptlog\Core\FormValidator'']] | | | ''FormValidator'' | [[scriptlog:lib:core:formvalidator|''Scriptlog\Core\FormValidator'']] | |
| | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | | | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | |
| | ''CommentDao'' | [[scriptlog:lib:dao:commentdao|''Scriptlog\Dao\CommentDao'']] | | | ''CommentDao'' | [[scriptlog:lib:dao:commentdao|''Scriptlog\Dao\CommentDao'']] | |
| |
| |