function CommentHelperCase::commentExists
7.x comment.test | CommentHelperCase::commentExists($comment, $reply = FALSE) |
Checks current page for specified comment.
Parameters
object $comment Comment object.:
boolean $reply The comment is a reply to another comment.:
Return value
boolean Comment found.
8 calls to CommentHelperCase::commentExists()
- CommentAnonymous::testAnonymous in drupal-7.x/
modules/ comment/ comment.test - Test anonymous comment functionality.
- CommentApprovalTest::testApprovalAdminInterface in drupal-7.x/
modules/ comment/ comment.test - Test comment approval functionality through admin/content/comment.
- CommentApprovalTest::testApprovalNodeInterface in drupal-7.x/
modules/ comment/ comment.test - Test comment approval functionality through node interface.
- CommentContentRebuild::testCommentRebuild in drupal-7.x/
modules/ comment/ comment.test - Test to ensure that the comment's content array is rebuilt for every call to comment_view().
- CommentInterfaceTest::testCommentInterface in drupal-7.x/
modules/ comment/ comment.test - Test comment interface.
File
- drupal-7.x/
modules/ comment/ comment.test, line 101 - Tests for comment.module.
Class
Code
function commentExists($comment, $reply = FALSE) {
if ($comment && is_object($comment)) {
$regex = '/' . ($reply ? '<div class="indented">(.*?)' : '');
$regex .= '<a id="comment-' . $comment->id . '"(.*?)'; // Comment anchor.
$regex .= '<div(.*?)'; // Begin in comment div.
$regex .= $comment->subject . '(.*?)'; // Match subject.
$regex .= $comment->comment . '(.*?)'; // Match comment.
$regex .= '/s';
return (boolean) preg_match($regex, $this->drupalGetContent());
}
else {
return FALSE;
}
}