Public Member Functions | |
| commentHandler ($comments, $commentsOwner, $commentLevel, $editLevel) | |
| addComment () | |
| editComment () | |
| deleteComment () | |
| cleanComments ($comments) | |
| replyto ($comments, $depth="", $commentlink, $newcommentid) | |
| numberOfComments () | |
| countComments ($comments) | |
| getComment ($whatcomment, $comments) | |
| renderComments () | |
| renderCommentsActual ($comments, &$listid, $commentlink="", $depth="") | |
| renderCommentsAdder () | |
| renderCommentsDelete () | |
| renderCommentEditor () | |
Public Attributes | |
| $commentsOwner | |
| Who owns that which is being edited? Used to check commenting and editing allowance levels against. | |
| $commentLevel | |
| The access level for editing the comments. | |
| $editLevel | |
| The access level for editing the comments data. | |
| $comments | |
| The array containing blog data. Just let commentHandler handle this - black box stuff, no need to know what's inside ;). | |
| $thisPageURL | |
| This can be set by the user, in case thisPageURL() doesn't return enough information (such as sub-items in a blog entry or gallery items or...). | |
| $commentsChanged = false | |
| This starts false, and will be set to true if the comments have changed (edited, hidden/shown, added, removed...). | |
| $lastCommenter | |
| The person who made a comment (set if commentsChanged == true). | |
| $lastComment | |
| The last comment. | |
| $allowNesting = true | |
| Do we allow nesting the comments? | |
$commenthandler = new commentHandler($yourCommentsArray, $yourCommentsOwner, $commentingAllowanceLevel, $editingAllowanceLevel); // This is where you input the comments data (to start it off, simply pass an empty array) $commenthandler->renderComments(); // Put this where you wish to show the actual comments $commenthandler->renderCommentsAdder(); // Put this where you wish to show the form for adding a new comment if ($commenthandler->commentsChanged) { // If the comments have changed... You don't actually have to check, but it's good for efficiency $yourCommentsArray = $commenthandler->comments; // Remember to save your comments again, commentHandler does not do that for you! file_put_contents($commentfilename, array_export($yourCommentsArray, "yourCommentsArray")); // Use for example array_export for saving it to file }
Definition at line 28 of file comment_handler.php.
| commentHandler::commentHandler | ( | $ | comments, | |
| $ | commentsOwner, | |||
| $ | commentLevel, | |||
| $ | editLevel | |||
| ) |
Constructor for the comments handler. Use the comments handler as described in the class documentation
| comments | Comments data array. If you have no array to begin with, simply pass an empty array. | |
| commentsOwner | String comtaining the user id of the parent data | |
| commentLevel | Integer containing an allowance level relative to commentsOwner for who is allowed to comment | |
| editLevel | Integer containing an allowance level relative to commentsOwner for who is allowed to edit the comments |
Definition at line 52 of file comment_handler.php.
References $commentLevel, $comments, $commentsOwner, $editLevel, addComment(), array_merge_n(), cleanComments(), commentLevel, deleteComment(), editComment(), editLevel, and thisPageURL().

| commentHandler::addComment | ( | ) |
Internal function used for adding a new comment
Definition at line 111 of file comment_handler.php.
References array_merge_2().
Referenced by commentHandler().

| commentHandler::editComment | ( | ) |
Internal function used for editing an existing comment
Definition at line 136 of file comment_handler.php.
References array_merge_2().
Referenced by commentHandler().

| commentHandler::deleteComment | ( | ) |
Internal function used for deleting an existing comment
Definition at line 163 of file comment_handler.php.
References array_merge_2().
Referenced by commentHandler().

| commentHandler::cleanComments | ( | $ | comments | ) |
Internal function used for cleaning up comments data
| comments | Uncleaned comments data array |
Definition at line 193 of file comment_handler.php.
References $comments.
Referenced by commentHandler().
| commentHandler::replyto | ( | $ | comments, | |
| $ | depth = "", |
|||
| $ | commentlink, | |||
| $ | newcommentid | |||
| ) |
Internal function used for creating the replyto targets
Definition at line 217 of file comment_handler.php.
References $comments, $i, and parse_profilelinks().
Referenced by renderCommentsAdder().

| commentHandler::numberOfComments | ( | ) |
Function which returns the number of comments in the current instance
Definition at line 238 of file comment_handler.php.
References countComments().

| commentHandler::countComments | ( | $ | comments | ) |
Internal function used above for counting the comments (the numberOfComments function is a dummy function created to make the API a little prettier)
| comments | Input a comments data array |
Definition at line 250 of file comment_handler.php.
References $comments.
Referenced by numberOfComments().
| commentHandler::getComment | ( | $ | whatcomment, | |
| $ | comments | |||
| ) |
Internal function used to get a single comment's data
| whatcomment | Which comment do you want to grab? | |
| comments | A comments data structure to get the comment from |
Definition at line 273 of file comment_handler.php.
References $comments.
Referenced by renderCommentEditor().
| commentHandler::renderComments | ( | ) |
renderComments renders the comments
Definition at line 290 of file comment_handler.php.
References renderCommentsActual().

| commentHandler::renderCommentsActual | ( | $ | comments, | |
| &$ | listid, | |||
| $ | commentlink = "", |
|||
| $ | depth = "" | |||
| ) |
The actual comments rendering function. The renderComments function is a dummy function that makes the API a little more pleasant
| $comments | The comments data | |
| $commentlink | The link... Just pass "" to this - used internally for recursion | |
| $depth | How deep are we? Just pass "" to this - used internally for recursion | |
| $listid | The comment index. Pass a variable $listid = 0 to this - used internally for recursion, for javascript replyto links |
Definition at line 308 of file comment_handler.php.
References $comments, $i, commentLevel, editLevel, formatTime(), i18n(), parse_page_data(), parse_profilelinks(), renderCommentEditor(), renderCommentsDelete(), and thisPageURL().
Referenced by renderComments().

| commentHandler::renderCommentsAdder | ( | ) |
Definition at line 380 of file comment_handler.php.
References $formatting_toolbar, $permissionlevels_array, $systemOptions, commentLevel, currentUser(), formatTime(), i18n(), renderInformationBox(), replyto(), and thisPageURL().

| commentHandler::renderCommentsDelete | ( | ) |
Internal function used for showing the inline comment deletion comfirmation dialog
Definition at line 441 of file comment_handler.php.
References i18n(), renderQuestionBox(), and thisPageURL().
Referenced by renderCommentsActual().

| commentHandler::renderCommentEditor | ( | ) |
Internal function used for showing the inline comment editing dialog
Definition at line 460 of file comment_handler.php.
References $formatting_toolbar, getComment(), i18n(), and thisPageURL().
Referenced by renderCommentsActual().

| commentHandler::$commentsOwner |
Who owns that which is being edited? Used to check commenting and editing allowance levels against.
Definition at line 30 of file comment_handler.php.
Referenced by commentHandler().
| commentHandler::$commentLevel |
The access level for editing the comments.
Definition at line 31 of file comment_handler.php.
Referenced by commentHandler().
| commentHandler::$editLevel |
The access level for editing the comments data.
Definition at line 32 of file comment_handler.php.
Referenced by commentHandler().
| commentHandler::$comments |
The array containing blog data. Just let commentHandler handle this - black box stuff, no need to know what's inside ;).
Definition at line 33 of file comment_handler.php.
Referenced by cleanComments(), commentHandler(), countComments(), getComment(), renderCommentsActual(), and replyto().
| commentHandler::$thisPageURL |
This can be set by the user, in case thisPageURL() doesn't return enough information (such as sub-items in a blog entry or gallery items or...).
Definition at line 34 of file comment_handler.php.
| commentHandler::$commentsChanged = false |
This starts false, and will be set to true if the comments have changed (edited, hidden/shown, added, removed...).
Definition at line 36 of file comment_handler.php.
| commentHandler::$lastCommenter |
The person who made a comment (set if commentsChanged == true).
Definition at line 37 of file comment_handler.php.
| commentHandler::$lastComment |
| commentHandler::$allowNesting = true |
1.5.5