public function detectSpam(array $fields = [], $threshold = 3) {

		$verify	= $this->requestValues->get('verify');
		$timer	= Session::getSessionDataBag()->get('antiSpamTimer');

		if(
			!$verify ||
			!isset($timer[$verify]) ||
			(microtime(true) - $timer[$verify] < 1)
		) {
			return true;
		}

		$label = md5($verify);

		if(is_null($this->requestValues->get('confirm_entry_' . $label)) || $this->requestValues->get('confirm_entry_' . $label) !== '') {
			return true;
		}

		foreach($fields as $f) {
			if(preg_match_all('~<\s*a\s+href\s*\=\s*(\\\\*"|\\\\*\'){0,1}http://~i', $this->requestValues->get($f), $tmp) > $threshold) {
				return true;
			}
			if(preg_match('~\[\s*url.*?\]~i', $this->requestValues->get($f))) {
				return true;
			}
		}
		return false;

	}
public function detectSpam(array $fields = [], $threshold = 3) {

		$verify	= $this->requestValues->get('verify');
		$timer	= Session::getSessionDataBag()->get('antiSpamTimer');

		if(
			!$verify ||
			!isset($timer[$verify]) ||
			(microtime(true) - $timer[$verify] < 1)
		) {
			return true;
		}

		$label = md5($verify);

		if(is_null($this->requestValues->get('confirm_entry_' . $label)) || $this->requestValues->get('confirm_entry_' . $label) !== '') {
			return true;
		}

		foreach($fields as $f) {
			if(preg_match_all('~<\s*a\s+href\s*\=\s*(\\\\*"|\\\\*\'){0,1}http://~i', $this->requestValues->get($f), $tmp) > $threshold) {
				return true;
			}
			if(preg_match('~\[\s*url.*?\]~i', $this->requestValues->get($f))) {
				return true;
			}
		}
		return false;

	}
public function detectSpam ( array $ fields = [ ] , $ threshold = 3 ) { $ verify = $ this -> requestValues -> get ( 'verify' ) ; $ timer = Session :: getSessionDataBag ( ) -> get ( 'antiSpamTimer' ) ; if ( ! $ verify || ! isset ( $ timer [ $ verify ] ) || ( microtime ( true ) - $ timer [ $ verify ] < 1 ) ) { return true ; } $ label = md5 ( $ verify ) ; if ( is_null ( $ this -> requestValues -> get ( 'confirm_entry_' . $ label ) ) || $ this -> requestValues -> get ( 'confirm_entry_' . $ label ) !== '' ) { return true ; } foreach ( $ fields as $ f ) { if ( preg_match_all ( '~<\s*a\s+href\s*\=\s*(\\\\*"|\\\\*\'){0,1}http://~i' , $ this -> requestValues -> get ( $ f ) , $ tmp ) > $ threshold ) { return true ; } if ( preg_match ( '~\[\s*url.*?\]~i' , $ this -> requestValues -> get ( $ f ) ) ) { return true ; } } return false ; }
check for spam

@param array $fields names of fields to check against spam
@param int $threshold number of suspicious content which when exceeded will indicate spam
@return boolean $spam_detected
check for spam