protected function filter() { // pull out the source from the filter object $source = $this->gateway_adapter->getData_Unstaged_Escaped('utm_source'); // a very complex filtering algorithm for sources $srcRules = $this->gateway_adapter->getGlobal('CustomFiltersSrcRules'); foreach ($srcRules as $regex => $risk_score_modifier) { /** * Note that regex pattern does not include delimiters. * These will need to be included in your custom regex patterns. */ if (preg_match("{$regex}", $source)) { $this->cfo->addRiskScore($risk_score_modifier, 'source'); // log it $log_msg = "\"" . addslashes($source) . "\""; $log_msg .= "\t\"" . addslashes($regex) . "\""; $log_msg .= "\t\"" . $this->cfo->getRiskScore() . "\""; $this->log($this->gateway_adapter->getData_Unstaged_Escaped('contribution_tracking_id'), 'Filter: Source', $log_msg); } } return TRUE; }
protected function filter() { // pull out the referrer from the gateway_adapter $referrer = $this->gateway_adapter->getData_Unstaged_Escaped('referrer'); // a very complex filtering algorithm for referrers $refRules = $this->gateway_adapter->getGlobal('CustomFiltersRefRules'); foreach ($refRules as $regex => $risk_score_modifier) { /** * note that the regex pattern does NOT include delimiters. * these will need to be included in your custom regex patterns. */ if (preg_match("{$regex}", $referrer)) { $this->cfo->addRiskScore($risk_score_modifier, 'referrer'); // log it //TODO: This sucks. $log_msg = "\"" . addslashes($referrer) . "\""; $log_msg .= "\t\"" . addslashes($regex) . "\""; $log_msg .= "\t\"" . $this->cfo->getRiskScore() . "\""; $this->log($this->gateway_adapter->getData_Unstaged_Escaped('contribution_tracking_id'), 'Filter: Referrer', $log_msg); } } return TRUE; }