function CommentHelperCase::commentExists in Drupal 7
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 modules/
comment/ comment.test - Test anonymous comment functionality.
- CommentApprovalTest::testApprovalAdminInterface in modules/
comment/ comment.test - Test comment approval functionality through admin/content/comment.
- CommentApprovalTest::testApprovalNodeInterface in modules/
comment/ comment.test - Test comment approval functionality through node interface.
- CommentContentRebuild::testCommentRebuild in modules/
comment/ comment.test - Test to ensure that the comment's content array is rebuilt for every call to comment_view().
- CommentInterfaceTest::testCommentInterface in modules/
comment/ comment.test - Test comment interface.
File
- modules/
comment/ comment.test, line 109 - Tests for comment.module.
Class
- CommentHelperCase
- @file Tests for comment.module.
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 (bool) preg_match($regex, $this
->drupalGetContent());
}
else {
return FALSE;
}
}