Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:dao:commentdao

This is an old revision of the document!


CommentDao

Layer: DAO · Source: lib/dao/CommentDao.php:20 (lines 20–392)


class CommentDao extends Dao

Docblock Metadata

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

Inheritance

^ Relation ^ Type ^ Meaning ^
| extends | [[scriptlog:lib:core:dao|''Dao'']] | parent class/interface |

Constants (0)

None.

Properties (0)

None declared.

Methods (18)

^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | Constructor | 28 |
| public | ''findComments()'' | Find Comments | 46 |
| public | ''findApprovedCommentsPaginated()'' | Find approved comments with pagination for API | 85 |
| public | ''countApprovedComments()'' | Count approved comments | 123 |
| public | ''findComment()'' | Find Comment | 149 |
| public | ''updateComment()'' | Update Comment | 178 |
| public | ''deleteComment()'' | DeleteComment | 201 |
| public | ''anonymizeComment()'' | Anonymize comment by replacing author info | 218 |
| public | ''anonymizeCommentsByEmail()'' | Anonymize all comments by user email | 241 |
| public | ''checkCommentId()'' | CheckCommentId | 267 |
| public | ''dropDownCommentStatement()'' | DropDownCommentStatement | 284 |
| public | ''totalCommentRecords()'' | TotalCommentRecords | 306 |
| public | ''countReplies()'' | Count Replies for a Comment | 319 |
| public | ''findCommentWithPost()'' | Find a single comment with post info (no sanitize required). | 333 |
| public | ''insertCommentApi()'' | Insert a comment with the given data and return the new ID. | 349 |
| public | ''updateCommentApi()'' | Update specific comment fields. | 362 |
| public | ''deleteCommentWithReplies()'' | Delete replies for a comment, then the comment itself. | 373 |
| public | ''getPostCommentStatus()'' | Get comment_status for a post. | 385 |

__construct()

public function __construct()

lines 28–31 (4)

Constructor

Takes no parameters.

findComments()

public function findComments($orderBy = 'ID', $email = null)

lines 46–73 (28)

Find Comments

When an email is provided, only comments authored by that email are returned (used by GDPR data export so the whole table is never loaded into memory and filtered in PHP).

^ Parameter ^ Type ^ Default ^ Description ^
| ''$orderBy'' | ''(untyped)'' | '''ID''' | -- default order By Id |
| ''$email'' | ''(untyped)'' | ''null'' | -- optional comment author email filter |

Returns: (none declared) — array

findApprovedCommentsPaginated()

public function findApprovedCommentsPaginated($limit, $offset, $sortBy = 'ID', $sortOrder = 'DESC', $postId = null)

lines 85–115 (31)

Find approved comments with pagination for API

^ Parameter ^ Type ^ Default ^ Description ^
| ''$limit'' | ''(untyped)'' | //required// | //none// |
| ''$offset'' | ''(untyped)'' | //required// | //none// |
| ''$sortBy'' | ''(untyped)'' | '''ID''' | //none// |
| ''$sortOrder'' | ''(untyped)'' | '''DESC''' | //none// |
| ''$postId'' | ''(untyped)'' | ''null'' | //none// |

Returns: (none declared) — array

countApprovedComments()

public function countApprovedComments($postId = null)

lines 123–138 (16)

Count approved comments

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

Returns: (none declared) — integer

findComment()

public function findComment($id, $sanitize)

lines 149–167 (19)

Find Comment

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

Returns: (none declared) — array

updateComment()

public function updateComment($sanitize, $bind, $ID)

lines 178–191 (14)

Update Comment

^ Parameter ^ Type ^ Default ^ Description ^
| ''$sanitize'' | ''(untyped)'' | //required// | //none// |
| ''$bind'' | ''(untyped)'' | //required// | //none// |
| ''$ID'' | ''(untyped)'' | //required// | //none// |

Returns: (none declared)

deleteComment()

public function deleteComment($id, $sanitize)

lines 201–209 (9)

DeleteComment

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

Returns: (none declared)

anonymizeComment()

public function anonymizeComment($commentId)

lines 218–233 (16)

Anonymize comment by replacing author info

Used for GDPR data deletion (Right to be Forgotten)

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

Returns: (none declared) — bool

anonymizeCommentsByEmail()

public function anonymizeCommentsByEmail($email)

lines 241–256 (16)

Anonymize all comments by user email

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

Returns: (none declared) — bool

checkCommentId()

public function checkCommentId($id, $sanitize)

lines 267–274 (8)

CheckCommentId

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

Returns: (none declared) — integer|numeric

dropDownCommentStatement()

public function dropDownCommentStatement($selected = '')

lines 284–297 (14)

DropDownCommentStatement

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

Returns: (none declared) — mixed

totalCommentRecords()

public function totalCommentRecords($data = null)

lines 306–311 (6)

TotalCommentRecords

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

Returns: (none declared) — numeric|int

countReplies()

public function countReplies($commentId)

lines 319–325 (7)

Count Replies for a Comment

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

Returns: (none declared) — int

findCommentWithPost()

public function findCommentWithPost($commentId)

lines 333–341 (9)

Find a single comment with post info (no sanitize required).

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

Returns: (none declared) — array|false

insertCommentApi()

public function insertCommentApi(array $data)

lines 349–353 (5)

Insert a comment with the given data and return the new ID.

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

Returns: (none declared) — int

updateCommentApi()

public function updateCommentApi($commentId, array $data)

lines 362–365 (4)

Update specific comment fields.

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

Returns: (none declared) — void

deleteCommentWithReplies()

public function deleteCommentWithReplies($commentId)

lines 373–377 (5)

Delete replies for a comment, then the comment itself.

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

Returns: (none declared) — void

getPostCommentStatus()

public function getPostCommentStatus($postId)

lines 385–391 (7)

Get comment_status for a post.

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

Returns: (none declared) — string|null

Imports

^ Alias ^ Fully-qualified name ^
| ''Dao'' | [[scriptlog:lib:core:dao|''Scriptlog\Core\Dao'']] |

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

scriptlog/lib/dao/commentdao.1790413760.txt.gz · Last modified: by admin