本文整理匯總了PHP中Akismet::setAkismetServer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Akismet::setAkismetServer方法的具體用法?PHP Akismet::setAkismetServer怎麽用?PHP Akismet::setAkismetServer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Akismet
的用法示例。
在下文中一共展示了Akismet::setAkismetServer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildAkismet
/**
* Build an Akismet object.
*
* @param string $key Authentication key.
* @param string $server Remote URL.
* @return Akismet
*/
private static function buildAkismet($key, $server = false)
{
$Akismet = new Akismet(Gdn::request()->url('/', true), $key);
if ($server) {
$Akismet->setAkismetServer($server);
}
return $Akismet;
}
示例2: Akismet
/**
* @return Akismet
*/
public static function Akismet()
{
static $Akismet;
if (!$Akismet) {
$Key = C('Plugins.Akismet.Key', C('Plugins.Akismet.MasterKey'));
if (!$Key) {
return NULL;
}
$Akismet = new Akismet(Gdn::Request()->Url('/', TRUE), $Key);
$Server = C('Plugins.Akismet.Server');
if ($Server) {
$Akismet->setAkismetServer($Server);
}
}
return $Akismet;
}
示例3: action_admin_moderate_comments
public function action_admin_moderate_comments($action, $comments, $handler)
{
$false_negatives = 0;
$false_positives = 0;
$provider = Options::get('habariakismet__provider');
$endpoint = $provider == 'Akismet' ? self::SERVER_AKISMET : self::SERVER_TYPEPAD;
$a = new Akismet(Site::get_url('habari'), Options::get('habariakismet__api_key'));
$a->setAkismetServer($endpoint);
foreach ($comments as $comment) {
switch ($action) {
case 'spam':
if ($comment->status == Comment::STATUS_APPROVED || $comment->status == Comment::STATUS_UNAPPROVED) {
$a->setCommentAuthor($comment->name);
$a->setCommentAuthorEmail($comment->email);
$a->setCommentAuthorURL($comment->url);
$a->setCommentContent($comment->content);
$a->submitSpam();
$false_negatives++;
}
break;
case 'approved':
if ($comment->status == Comment::STATUS_SPAM) {
$a->setCommentAuthor($comment->name);
$a->setCommentAuthorEmail($comment->email);
$a->setCommentAuthorURL($comment->url);
$a->setCommentContent($comment->content);
$a->submitHam();
$false_positives++;
}
break;
}
}
if ($false_negatives) {
Session::notice(_t('Reported %d false negatives to %s.', array($false_negatives, $provider)));
}
if ($false_positives) {
Session::notice(_t('Reported %d false positives to %s.', array($false_positives, $provider)));
}
}