You are here

public function Cleantalk::getCleantalkCommentHash in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7 cleantalk.module \Cleantalk::getCleantalkCommentHash()
  2. 7.2 cleantalk.module \Cleantalk::getCleantalkCommentHash()
  3. 7.4 src/Cleantalk.php \Cleantalk::getCleantalkCommentHash()

Function to get the message hash from Cleantalk.ru comment

Parameters

$message:

Return value

null

File

src/Cleantalk.php, line 572

Class

Cleantalk
Cleantalk Base class

Code

public function getCleantalkCommentHash($message) {
  $matches = array();
  if (preg_match('/\\n\\n\\*\\*\\*.+([a-z0-9]{32}).+\\*\\*\\*$/', $message, $matches)) {
    return $matches[1];
  }
  else {
    if (preg_match('/\\<br.*\\>[\\n]{0,1}\\<br.*\\>[\\n]{0,1}\\*\\*\\*.+([a-z0-9]{32}).+\\*\\*\\*$/', $message, $matches)) {
      return $matches[1];
    }
  }
  return NULL;
}