CommentWrites final class
Minn\Runtime\CommentWrites · public/minn/src/Minn/Runtime/CommentWrites.php · 312 lines
Comments written as WordPress's comment functions write them: a comment stored and changed, its status set (to the trash or spam with the status it had kept aside, and back), deleted, and a post's count of approved comments kept; each step with the actions and filters the reference fires in its order, and the cached rows let go.
Constants and properties
| private | DEFAULTS = array ( 'comment_post_ID' => 0, 'comment_author' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_author_IP' => '', 'comment_date' => '', 'comment_date_gmt' => '', 'comment_content' => '', 'comment_karma' => 0, 'comment_approved' => '1', 'comment_agent' => '', 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, ) | The columns a stored comment has, each with what a new comment takes when it gives none (an integer column is read as one). |
Public
| static | insert(mixed $commentdata): int# | A comment stored (wp_insert_comment): its id, the post's count kept when it is approved, then wp_insert_comment told. |
| static | updateCount(mixed $postId, mixed $deferred = false): bool# | A post's approved comments counted (wp_update_comment_count): put off while counting is deferred; asked with $deferred, the posts put off are counted now and the answer is true. |
| static | updateCountNow(mixed $postId): bool# | A post's approved comments counted now (wp_update_comment_count_now), unless pre_wp_update_comment_count_now supplies the count; plugins told the old and new counts, then the post edited. |
| static | update(mixed $commentarr, mixed $wpError = false): mixed# | A comment changed (wp_update_comment): the stored comment under the change, through the field filters and comment_save_pre, then wp_update_comment_data (handed the data, the stored comment and the change); the columns written, the post's count, edit_comment with the columns, and the status transition. 0 when nothing changed. |
| static | setStatus(mixed $commentId, mixed $status, mixed $wpError = false): bool# | A comment's status set (wp_set_comment_status): hold, approve, spam or trash; false for an unknown comment or status. |
| static | statusWord(mixed $stored): string# | A stored comment status in the words the transition actions use: approved, unapproved, spam, trash. |
| static | transitionStatus(mixed $newStatus, mixed $oldStatus, mixed $comment): void# | What plugins are told when a comment changes status (wp_transition_comment_status); one that keeps its status hears only comment_{status}_{type}. |
| static | cleanCache(mixed $ids): void# | Comments' cached rows and meta let go (clean_comment_cache), plugins told about each. |
| static | delete(mixed $commentId, mixed $force = false): bool# | A comment deleted (wp_delete_comment): to the trash first unless forced, it is there already or the trash is off; its replies moved up to its parent; the post recounted when it was approved. |
| static | trash(mixed $commentId): bool# | A comment to the trash (wp_trash_comment), or deleted when the trash is off. |
| static | untrash(mixed $commentId): bool# | A comment back from the trash (wp_untrash_comment). |
| static | spam(mixed $commentId): bool# | A comment marked spam (wp_spam_comment). |
| static | unspam(mixed $commentId): bool# | A comment back from spam (wp_unspam_comment). |
| static | trashPostComments(mixed $post = NULL): mixed# | A post's comments to the trash with it (wp_trash_post_comments): each becomes post-trashed, its status kept on the post to give back; how many changed (one set aside with its post already does not count). |
| static | untrashPostComments(mixed $post = NULL): mixed# | A post back from the trash gives its comments their statuses back (wp_untrash_post_comments). |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | setAside(mixed $commentId, string $status, string $before, string $after): bool# | A comment moved to the trash or spam: the first action, the status change, the status it had kept aside with the time, the second action. |
| private | restore(mixed $commentId, string $before, string $after): bool# | A comment back from the trash or spam to the status kept aside (held when none was), between the two actions. |
| private | store(): Minn\Content\Comments# |
Nothing matches.