当前位置: 首页>>代码示例>>PHP>>正文


PHP Akismet::setCommentAuthorEmail方法代码示例

本文整理汇总了PHP中Akismet::setCommentAuthorEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Akismet::setCommentAuthorEmail方法的具体用法?PHP Akismet::setCommentAuthorEmail怎么用?PHP Akismet::setCommentAuthorEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Akismet的用法示例。


在下文中一共展示了Akismet::setCommentAuthorEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: commentValidate

 public function commentValidate($comment)
 {
     $result = null;
     if (!$comment['contact_id'] && ($api_key = $this->getSettingValue('api_key')) && class_exists('Akismet')) {
         $url = wa()->getRouteUrl('blog', array(), true);
         $post_url = null;
         if (isset($comment['post_data'])) {
             $post_url = blogPost::getUrl($comment['post_data']);
             if (is_array($post_url)) {
                 $post_url = array_shift($post_url);
             }
         }
         $akismet = new Akismet($url, $api_key);
         $akismet->setCommentAuthor($comment['name']);
         $akismet->setCommentAuthorEmail($comment['email']);
         //$akismet->setCommentAuthorURL($comment['site']);
         $akismet->setCommentContent($comment['text']);
         if ($post_url) {
             $akismet->setPermalink($post_url);
         }
         if ($akismet->isCommentSpam()) {
             $result = array('text' => _wp('According to Akismet.com, your comment very much looks like spam, thus will not be published. Please rewrite your comment. Sorry for the inconvenience.'));
         }
     }
     return $result;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:26,代码来源:blogAkismet.plugin.php

示例2:

 function __construct($comment)
 {
     $ini = eZINI::instance('akismet.ini');
     $blogURL = $ini->variable('SiteSettings', 'BlogURL');
     $apiKey = $ini->variable('AccountSettings', 'APIKey');
     parent::__construct($blogURL, $apiKey);
     if (isset($comment['permalink'])) {
         parent::setPermalink($comment['permalink']);
     }
     if ($comment['type']) {
         parent::setCommentType($comment['type']);
     }
     if (isset($comment['author'])) {
         parent::setCommentAuthor($comment['author']);
     } else {
         parent::setCommentAuthor('');
     }
     if (isset($comment['email'])) {
         parent::setCommentAuthorEmail($comment['email']);
     }
     if ($comment['website']) {
         parent::setCommentAuthorURL($comment['website']);
     }
     if ($comment['body']) {
         parent::setCommentContent($comment['body']);
     }
 }
开发者ID:BGCX067,项目名称:ezakismet-svn-to-git,代码行数:27,代码来源:ezakismet.php

示例3: HandleGuestStore

function HandleGuestStore($pagename, $auth)
{
    global $wpcom_api_key, $wpcom_home;
    $akismet = new Akismet($wpcom_home, $wpcom_api_key);
    $akismet->setCommentAuthor($_POST['name']);
    $akismet->setCommentAuthorEmail($_POST['email']);
    $akismet->setCommentAuthorURL($_POST['url']);
    $akismet->setCommentContent($_POST['comment']);
    $itemurl = $pagename . date("Ymd") . "-" . uniqid();
    $akismet->setPermalink($itemurl);
    $page['name'] = $itemurl;
    $page['text'] = "----\n";
    $page['text'] .= strlen($_POST['name']) > 0 ? $_POST['name'] : "Unbekannt";
    if (strlen($_POST['email']) > 0) {
        $page['text'] .= " [[✉->mailto:";
        $page['text'] .= $_POST['email'];
        $page['text'] .= "]]";
    }
    if (strlen($_POST['url']) > 0) {
        $page['text'] .= " [[➚->";
        $page['text'] .= substr($_POST['url'], 0, 4) == "http" ? $_POST['url'] : "http://" . $_POST['url'];
        $page['text'] .= "]]";
    }
    $page['text'] .= " schrieb am ";
    $page['text'] .= date("d.m.Y");
    $page['text'] .= ":\n\n";
    $page['text'] .= $_POST['comment'];
    $page['text'] .= $akismet->isCommentSpam() ? "(:spam: true:)" : "(:spam: false:)";
    $page['time'] = $Now;
    $page['host'] = $_SERVER['REMOTE_ADDR'];
    $page['agent'] = @$_SERVER['HTTP_USER_AGENT'];
    UpdatePage($page['name'], $page, $page);
    HandleBrowse($pagename);
}
开发者ID:ansgar,项目名称:pmguest,代码行数:34,代码来源:guest.php

示例4: isSpam

 public function isSpam()
 {
     require APP . 'Plugin' . DS . 'Comment' . DS . 'Vendor' . DS . 'akismet.php';
     App::uses('Akismet', 'Vendor');
     $akismet = new Akismet(Configure::read('Plugin.Comment.akismet.site'), Configure::read('Plugin.Comment.akismet.key'));
     $akismet->setCommentAuthor($this->data['Comment']['username']);
     $akismet->setCommentAuthorEmail($this->data['Comment']['mail']);
     $akismet->setCommentContent($this->data['Comment']["content"]);
     $akismet->setUserIP($this->data['Comment']['ip']);
     return $akismet->isCommentSpam();
 }
开发者ID:naveen-netgen,项目名称:CakePHP-Comment,代码行数:11,代码来源:Comment.php

示例5: perform

 /**
  * check if a comment is spam through Akismet
  *
  * @param mixed $data Data passed to this action
  * @return bool TRUE if comment is spam else FALSE
  */
 public function perform($data = FALSE)
 {
     include_once JAPA_BASE_DIR . 'modules/common/includes/Akismet.class.php';
     $akismet = new Akismet($data['url'], $data['key']);
     $akismet->setCommentAuthor($data['user']['name']);
     $akismet->setCommentAuthorEmail($data['user']['email']);
     $akismet->setCommentAuthorURL($data['user']['url']);
     $akismet->setCommentContent($data['user']['comment']);
     $akismet->setPermalink($data['permaLink']);
     return $akismet->isCommentSpam();
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:17,代码来源:ActionCommonSpam.php

示例6: checkSpam

 function checkSpam($api, $blogUrl, $name, $email, $url, $comment, &$msgA)
 {
     require_once JPATH_COMPONENT . DS . 'assets' . DS . 'akismet' . DS . 'Akismet.class.php';
     $akismet = new Akismet($blogUrl, $api);
     $akismet->setCommentAuthor($name);
     $akismet->setCommentAuthorEmail($email);
     $akismet->setCommentAuthorURL($url);
     $akismet->setCommentContent($comment);
     if ($akismet->isKeyValid()) {
     } else {
         $msgA = 'Akismet: Key is invalid';
     }
     //trigger_error("Akismet: ".$akismet->isCommentSpam(),E_USER_WARNING);
     return $akismet->isCommentSpam();
 }
开发者ID:christopherstock,项目名称:Joomla3_Tini,代码行数:15,代码来源:phocaguestbookakismet.php

示例7: q_isspam

function q_isspam($q)
{
    if (get_option('q_filter_spam') == 'TRUE') {
        global $current_user;
        get_currentuserinfo();
        $akismet = new Akismet(get_bloginfo('wpurl'), get_option('q_wpcomAPIkey'));
        $akismet->setCommentAuthor($current_user->user_login);
        $akismet->setCommentAuthorEmail($current_user->user_email);
        $akismet->setCommentAuthorURL($current_user->user_url);
        $akismet->setCommentContent($q);
        if ($akismet->isCommentSpam()) {
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:17,代码来源:spamquestions.php

示例8: create

 /**
  * Function: create
  * Attempts to create a comment using the passed information. If the Akismet API key is present, it will check it.
  *
  * Parameters:
  *     $body - The comment.
  *     $author - The name of the commenter.
  *     $url - The commenter's website.
  *     $email - The commenter's email.
  *     $post - The <Post> they're commenting on.
  *     $parent - The <Comment> they're replying to.
  *     $notify - Notification on follow-up comments.
  *     $type - The type of comment. Optional, used for trackbacks/pingbacks.
  */
 static function create($body, $author, $url, $email, $post, $parent, $notify, $type = null)
 {
     if (!self::user_can($post->id) and !in_array($type, array("trackback", "pingback"))) {
         return;
     }
     $config = Config::current();
     $route = Route::current();
     $visitor = Visitor::current();
     if (!$type) {
         $status = $post->user_id == $visitor->id ? "approved" : $config->default_comment_status;
         $type = "comment";
     } else {
         $status = $type;
     }
     if (!empty($config->akismet_api_key)) {
         $akismet = new Akismet($config->url, $config->akismet_api_key);
         $akismet->setCommentContent($body);
         $akismet->setCommentAuthor($author);
         $akismet->setCommentAuthorURL($url);
         $akismet->setCommentAuthorEmail($email);
         $akismet->setPermalink($post->url());
         $akismet->setCommentType($type);
         $akismet->setReferrer($_SERVER['HTTP_REFERER']);
         $akismet->setUserIP($_SERVER['REMOTE_ADDR']);
         if ($akismet->isCommentSpam()) {
             self::add($body, $author, $url, $email, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], "spam", $post->id, $visitor->id, $parent, $notify);
             error(__("Spam Comment"), __("Your comment has been marked as spam. It has to be reviewed and/or approved by an admin.", "comments"));
         } else {
             $comment = self::add($body, $author, $url, $email, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $status, $post->id, $visitor->id, $parent, $notify);
             fallback($_SESSION['comments'], array());
             $_SESSION['comments'][] = $comment->id;
             if (isset($_POST['ajax'])) {
                 exit("{ \"comment_id\": \"" . $comment->id . "\", \"comment_timestamp\": \"" . $comment->created_at . "\" }");
             }
             Flash::notice(__("Comment added."), $post->url() . "#comments");
         }
     } else {
         $comment = self::add($body, $author, $url, $email, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $status, $post->id, $visitor->id, $parent, $notify);
         fallback($_SESSION['comments'], array());
         $_SESSION['comments'][] = $comment->id;
         if (isset($_POST['ajax'])) {
             exit("{ \"comment_id\": \"" . $comment->id . "\", \"comment_timestamp\": \"" . $comment->created_at . "\" }");
         }
         Flash::notice(__("Comment added."), $post->url() . "#comment");
     }
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:60,代码来源:model.Comment.php

示例9: queryAkismet

 public function queryAkismet($author, $textDiff, $permalink)
 {
     global $wgMWAkismetKey;
     global $wgMWAkismetURL;
     // First check to see if the config settings are set
     if ($wgMWAkismetKey == '' || $wgMWAkismetURL == '') {
         echo "Akismet key and url must be set.  Instructions for getting a key are here: <a href=\"http://faq.wordpress.com/2005/10/19/api-key/\">API key FAQ on Wordpress.com</a>";
         die;
     }
     $akismet = new Akismet($wgMWAkismetURL, $wgMWAkismetKey);
     $akismet->setCommentAuthor($author);
     $akismet->setCommentAuthorEmail("");
     $akismet->setCommentAuthorURL("");
     $akismet->setCommentContent($textDiff);
     $akismet->setPermalink($permalink);
     $isSpam = $akismet->isCommentSpam();
     return $isSpam;
 }
开发者ID:aag,项目名称:mwakismet,代码行数:18,代码来源:MwAkismet.class.php

示例10: eventRmcommonCheckPostSpam

 /**
  * This event check spam in comments, posts and other contents for modules
  * 
  * @param array All params to check (blogurl, name, email, url, text, permalink)
  * @return bool
  */
 public function eventRmcommonCheckPostSpam($params)
 {
     $config = RMFunctions::get()->plugin_settings('akismet', true);
     if ($config['key'] == '') {
         return;
     }
     extract($params);
     $akismet = new Akismet($blogurl, $config['key']);
     $akismet->setCommentAuthor($name);
     $akismet->setCommentAuthorEmail($email);
     $akismet->setCommentAuthorURL($url);
     $akismet->setCommentContent($text);
     $akismet->setPermalink($permalink);
     $akismet->setUserIP($_SERVER['REMOTE_ADDR']);
     if ($akismet->isCommentSpam()) {
         return false;
     }
     return true;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:25,代码来源:rmcommon.php

示例11: execute

 public function execute()
 {
     $comment_id = (int) waRequest::post('spam');
     $comment_model = new blogCommentModel();
     $comment = $comment_model->getById($comment_id);
     $this->response['status'] = null;
     if ($comment) {
         $comment_model->updateById($comment_id, array('akismet_spam' => 1, 'status' => blogCommentModel::STATUS_DELETED));
         $this->response['status'] = blogCommentModel::STATUS_DELETED;
         $blog_plugin = wa()->getPlugin('akismet');
         $akismet = new Akismet(wa()->getRouting()->getUrl('blog', array(), true), $blog_plugin->getSettingValue('api_key'));
         $akismet->setCommentAuthor($comment['name']);
         $akismet->setCommentAuthorEmail($comment['email']);
         $akismet->setCommentContent($comment['text']);
         if (!waSystemConfig::isDebug() && $blog_plugin->getSettingValue('send_spam')) {
             $akismet->submitSpam();
         }
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:19,代码来源:blogAkismetPluginBackend.controller.php

示例12: akismet_scan

function akismet_scan($Data, $Setup, $Config)
{
    if (empty($Setup['_APIKey'])) {
        return false;
    }
    include_once WP_PLUGIN_DIR . '/db-toolkit/data_form/processors/akismet/Akismet.class.php';
    $WordPressAPIKey = $Setup['_APIKey'];
    $MyBlogURL = get_bloginfo('url');
    $akismet = new Akismet($MyBlogURL, $WordPressAPIKey);
    $akismet->setCommentAuthor($Data[$Setup['_Name']]);
    $akismet->setCommentAuthorEmail($Data[$Setup['_Email']]);
    $akismet->setCommentAuthorURL($Data[$Setup['_URL']]);
    $akismet->setCommentContent($Data[$Setup['_Text']]);
    $akismet->setUserIP($_SERVER['REMOTE_ADDR']);
    if ($akismet->isCommentSpam()) {
        return true;
    } else {
        return false;
    }
    return false;
}
开发者ID:routexl,项目名称:DB-Toolkit,代码行数:21,代码来源:functions.php

示例13: spamurai_content_verify

function spamurai_content_verify($pObject, $pParamHash)
{
    global $gBitUser, $gBitSystem;
    // hardcode limit spamurai to BitBlogPost and BitUser. more enterprising person can write some cool admin config.
    // for now, these are the limits cause doing everything is slow and produces many false positives for content with limited text
    if ($gBitSystem->isPackageActive('spamurai') && !$gBitUser->hasPermission('p_spamurai_moderate') && (is_a($pObject, 'LibertyComment') || is_a($pObject, 'BitBlogPost') || is_a($pObject, 'BitUser'))) {
        $akismet = new Akismet(BOARDS_PKG_URI, $gBitSystem->getConfig('spamurai_api_key'));
        if (!empty($pParamHash) && !empty($akismet)) {
            $userInfo = $gBitUser->getUserInfo(array('user_id' => $pParamHash['user_id']));
            $akismet->setCommentAuthor($userInfo['real_name'] . $userInfo['login']);
            $akismet->setCommentAuthorEmail($userInfo['email']);
            $checkTitle = '';
            if (!empty($pParamHash['title'])) {
                $checkTitle .= $pParamHash['title'];
            }
            if (!empty($pParamHash['comment_title'])) {
                $checkTitle .= $pParamHash['comment_title'];
            }
            $checkString = '';
            if (!empty($pParamHash['edit'])) {
                $checkString .= $pParamHash['edit'];
            }
            if (!empty($pParamHash['comment_data'])) {
                $checkString .= $pParamHash['comment_data'];
            }
            if (!empty($checkString) || !empty($checkTitle)) {
                $akismet->setCommentContent($checkTitle . $checkString);
                if ($akismet->isCommentSpam()) {
                    if ($gBitUser->isRegistered()) {
                        bit_error_log('SPAM ' . $pObject->getContentType() . ' for user ' . $userInfo['user_id']);
                    }
                    $insertSql = "INSERT INTO " . BIT_DB_PREFIX . "spamurai_log (user_id, email, subject, data, posted_date, ip) VALUES ( ?, ?, ?, ?, ?, ? )";
                    $bindVars = array($pParamHash['user_id'], $userInfo['email'], substr($checkTitle, 0, 255), $checkString, time(), $_SERVER['REMOTE_ADDR']);
                    $gBitSystem->mDb->query($insertSql, $bindVars);
                    $pObject->mErrors['spam'] = "This comment has been blocked as spam";
                }
            }
        }
    }
}
开发者ID:bitweaver,项目名称:spamurai,代码行数:40,代码来源:Spamurai.php

示例14: isSpam

 /**
  * Use Akismet to check comment data for spam
  *
  * @param array $data
  * @return array Data with spam field set
  */
 function isSpam(&$data)
 {
     $apiKey = Configure::read('AppSettings.wordpress_api_key');
     if (empty($apiKey)) {
         return false;
     }
     try {
         App::import('Vendor', 'akismet');
         $siteUrl = 'http://' . getenv('SERVER_NAME');
         $akismet = new Akismet($siteUrl, $apiKey);
         $akismet->setCommentAuthor($data[$this->name]['name']);
         $akismet->setCommentAuthorEmail($data[$this->name]['email']);
         $akismet->setCommentAuthorURL($data[$this->name]['url']);
         $akismet->setCommentContent($data[$this->name]['content']);
         $akismet->setPermalink($data['Post']['permalink']);
         if ($akismet->isCommentSpam()) {
             return true;
         }
     } catch (Exception $e) {
         $this->log('Akismet not reachable!');
     }
     return false;
 }
开发者ID:Jaciss,项目名称:wildflower,代码行数:29,代码来源:wild_comment.php

示例15: isSpam

 /**
  * Use Akismet to check comment data for spam
  *
  * @param array $data
  * @return bool
  */
 function isSpam(&$data)
 {
     $apiKey = Configure::read('Wildflower.settings.wordpress_api_key');
     if (empty($apiKey)) {
         return false;
     }
     try {
         App::import('Vendor', 'akismet');
         $siteUrl = Configure::read('Wildflower.fullSiteUrl');
         $akismet = new Akismet($siteUrl, $apiKey);
         $akismet->setCommentAuthor($data[$this->name]['name']);
         $akismet->setCommentAuthorEmail($data[$this->name]['email']);
         $akismet->setCommentAuthorURL($data[$this->name]['url']);
         $akismet->setCommentContent($data[$this->name]['content']);
         $akismet->setPermalink($data['Post']['permalink']);
         if ($akismet->isCommentSpam()) {
             return true;
         }
     } catch (Exception $e) {
         trigger_error('Akismet not reachable: ' . $e->message);
     }
     return false;
 }
开发者ID:uuking,项目名称:wildflower,代码行数:29,代码来源:comment.php


注:本文中的Akismet::setCommentAuthorEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。