Checks current page for specified comment.
object $comment Comment object.:
boolean $reply The comment is a reply to another comment.:
boolean Comment found.
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;
}
}