You are here

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

Same name and namespace in other branches
  1. 7.5 src/Cleantalk.php \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

./cleantalk.module, line 840
Main CleanTalk integration module functions.

Class

Cleantalk
Cleantalk class create request

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;
}