20 public function isSpam(array $vars = array()) {
21 foreach ($vars as $k=>$v)
25 $this->cfg->apiKey.
'.'.$this->cfg->apiServer,
26 '/'.$this->cfg->apiVersion.
'/comment-check',
27 $this->getQueryString());
29 if ($response[1] ==
'invalid' && !$this->
verifyKey())
30 throw new nException(
'The API key passed to the Akismet helper is invalid. Please obtain a valid one from https://akismet.com/signup/');
32 return ($response[1] ==
'true');
41 foreach ($vars as $k=>$v)
45 $this->cfg->apiKey.
'.'.$this->cfg->apiServer,
46 '/'.$this->cfg->apiVersion.
'/submit-spam',
47 $this->getQueryString());
56 foreach($vars as $k=>$v)
60 $this->cfg->apiKey.
'.'.$this->cfg->apiServer,
61 '/'.$this->cfg->apiVersion.
'/submit-ham',
62 $this->getQueryString());
73 $this->cfg->setInArray(
'comment', $key, $val);
119 $this->cfg->apiServer,
120 '/'.$this->cfg->apiVersion.
'/verify-key',
121 'key='.$this->cfg->apiKey.
'&blog='.$this->cfg->url);
122 return $response[1] ==
'valid';
134 $httpRequest =
"POST ".$path.
" HTTP/1.0\r\n";
135 $httpRequest.=
"Host: ".$host.
"\r\n";
136 $httpRequest.=
"Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n";
137 $httpRequest.=
"Content-Length: ".strlen($request).
"\r\n";
138 $httpRequest.=
"User-Agent: ".$this->cfg->userAgent.
"\r\n";
139 $httpRequest.=
"\r\n";
140 $httpRequest.= $request;
143 if (
false !== ($fs = @fsockopen($host, $this->cfg->apiPort, $errno, $errstr, 3))) {
144 fwrite($fs, $httpRequest);
146 $response.= fgets($fs, 1160);
148 $response = explode(
"\r\n\r\n", $response, 2);
159 $queryString =
'blog='.urlencode(stripslashes($this->cfg->url)).
'&';
160 $queryString.=
'user_agent='.urlencode(stripslashes($this->cfg->userAgent)).
'&';
161 foreach ($this->cfg->comment as $k=>$v)
162 $queryString.= $k.
'='.urlencode(stripslashes($v)).
'&';
164 $vars = array_diff_key($_SERVER, array_flip($this->cfg->ignoreServerVars));
165 foreach ($vars as $k=>$v)
166 $queryString.= $k.
'='.urlencode(stripslashes($v)).
'&';
submitSpam(array $vars=array())
isSpam(array $vars=array())
setCommentVar($key, $val)
sendRequest($host, $path, $request)
submitHam(array $vars=array())