Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:service:commentservice

This is an old revision of the document!


CommentService

Layer: Service · Source: lib/service/CommentService.php:22 (lines 22–300)


class CommentService

Docblock Metadata

^ Tag ^ Value ^
| ''@category'' | Service class |
| ''@author'' | M.Noermoehammad |
| ''@license'' | MIT |
| ''@version'' | 1.0 |
| ''@since'' | Since Release 1.0 |

Inheritance

No parent, interface or trait. This is a root type.

Constants (0)

None.

Properties (0)

None declared.

Methods (23)

^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | (undocumented) | 97 |
| public | ''setCommentId()'' | (undocumented) | 104 |
| public | ''setPostId()'' | (undocumented) | 109 |
| public | ''setAuthorName()'' | (undocumented) | 114 |
| public | ''setAuthorIP()'' | (undocumented) | 119 |
| public | ''setAuthorEmail()'' | (undocumented) | 124 |
| public | ''setCommentContent()'' | (undocumented) | 129 |
| public | ''setCommentStatus()'' | (undocumented) | 134 |
| public | ''setCommentDate()'' | (undocumented) | 139 |
| public | ''grabComments()'' | (undocumented) | 144 |
| public | ''grabComment()'' | (undocumented) | 149 |
| public | ''getApprovedCommentsApi()'' | Get paginated approved comments for API | 164 |
| public | ''countApprovedCommentsApi()'' | Count approved comments for API | 176 |
| public | ''modifyComment()'' | (undocumented) | 181 |
| public | ''removeComment()'' | Remove Comment | 197 |
| public | ''commentStatementDropDown()'' | Comment Statement DropDown | 217 |
| public | ''totalComments()'' | Total Comments recorded | 229 |
| public | ''countReplies()'' | Count Replies for a Comment | 240 |
| 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 | ''updateCommentApi()'' | Update a comment with raw data for the API. | 274 |
| public | ''removeCommentApi()'' | Delete a comment and its replies for the API. | 285 |
| public | ''checkPostAcceptsComments()'' | Check if a post exists and allows comments. | 296 |

__construct()

public function __construct(CommentDao $commentDao, FormValidator $validator, Sanitize $sanitize)

lines 97–102 (6)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$commentDao'' | [[scriptlog:lib:dao:commentdao|''CommentDao'']] | //required// | //none// |
| ''$validator'' | [[scriptlog:lib:core:formvalidator|''FormValidator'']] | //required// | //none// |
| ''$sanitize'' | [[scriptlog:lib:core:sanitize|''Sanitize'']] | //required// | //none// |

setCommentId()

public function setCommentId($comment_id)

lines 104–107 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$comment_id'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setPostId()

public function setPostId($post_id)

lines 109–112 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$post_id'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setAuthorName()

public function setAuthorName($author_name)

lines 114–117 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$author_name'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setAuthorIP()

public function setAuthorIP($author_ip)

lines 119–122 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$author_ip'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setAuthorEmail()

public function setAuthorEmail($author_email)

lines 124–127 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$author_email'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setCommentContent()

public function setCommentContent($content)

lines 129–132 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$content'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setCommentStatus()

public function setCommentStatus($status)

lines 134–137 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$status'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

setCommentDate()

public function setCommentDate($created_at)

lines 139–142 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$created_at'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

grabComments()

public function grabComments($orderBy = 'ID')

lines 144–147 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$orderBy'' | ''(untyped)'' | '''ID''' | //none// |

Returns: (none declared)

grabComment()

public function grabComment($id)

lines 149–152 (4)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$id'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

getApprovedCommentsApi()

public function getApprovedCommentsApi($page = 1, $perPage = 10, $sortBy = 'ID', $sortOrder = 'DESC', $postId = null)

lines 164–168 (5)

Get paginated approved comments for API

^ Parameter ^ Type ^ Default ^ Description ^
| ''$page'' | ''(untyped)'' | ''1'' | //none// |
| ''$perPage'' | ''(untyped)'' | ''10'' | //none// |
| ''$sortBy'' | ''(untyped)'' | '''ID''' | //none// |
| ''$sortOrder'' | ''(untyped)'' | '''DESC''' | //none// |
| ''$postId'' | ''(untyped)'' | ''null'' | //none// |

Returns: (none declared) — array

countApprovedCommentsApi()

public function countApprovedCommentsApi($postId = null)

lines 176–179 (4)

Count approved comments for API

^ Parameter ^ Type ^ Default ^ Description ^
| ''$postId'' | ''(untyped)'' | ''null'' | //none// |

Returns: (none declared) — integer

modifyComment()

public function modifyComment()

lines 181–191 (11)

Takes no parameters.

Returns: (none declared)

removeComment()

public function removeComment()

lines 197–208 (12)

Remove Comment

Takes no parameters.

Returns: (none declared) — integer

commentStatementDropDown()

public function commentStatementDropDown($selected = "")

lines 217–220 (4)

Comment Statement DropDown

^ Parameter ^ Type ^ Default ^ Description ^
| ''$selected'' | ''(untyped)'' | ''""'' | //none// |

Returns: (none declared) — string

totalComments()

public function totalComments($data = null)

lines 229–232 (4)

Total Comments recorded

^ Parameter ^ Type ^ Default ^ Description ^
| ''$data'' | ''(untyped)'' | ''null'' | //none// |

Returns: (none declared) — integer

countReplies()

public function countReplies($commentId)

lines 240–243 (4)

Count Replies for a Comment

^ Parameter ^ Type ^ Default ^ Description ^
| ''$commentId'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared) — int

getCommentApi()

public function getCommentApi($commentId)

lines 251–254 (4)

Get a single comment with post info for the API.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$commentId'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared) — array|false

createCommentApi()

public function createCommentApi(array $data)

lines 262–265 (4)

Create a comment from raw data for the API.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$data'' | ''array'' | //required// | //none// |

Returns: (none declared) — int

updateCommentApi()

public function updateCommentApi($commentId, array $data)

lines 274–277 (4)

Update a comment with raw data for the API.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$commentId'' | ''(untyped)'' | //required// | //none// |
| ''$data'' | ''array'' | //required// | //none// |

Returns: (none declared) — void

removeCommentApi()

public function removeCommentApi($commentId)

lines 285–288 (4)

Delete a comment and its replies for the API.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$commentId'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared) — void

checkPostAcceptsComments()

public function checkPostAcceptsComments($postId)

lines 296–299 (4)

Check if a post exists and allows comments.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$postId'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared) — string|null Returns comment_status value or null if post not found

Imports

^ Alias ^ Fully-qualified name ^
| ''FormValidator'' | [[scriptlog:lib:core:formvalidator|''Scriptlog\Core\FormValidator'']] |
| ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] |
| ''CommentDao'' | [[scriptlog:lib:dao:commentdao|''Scriptlog\Dao\CommentDao'']] |

This page is generated from source by 'tools/gendoc'. Edits will be overwritten.

scriptlog/lib/service/commentservice.1790413760.txt.gz · Last modified: by admin