本文整理汇总了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)));
}
}