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


PHP Akismet::setCommentContent方法代码示例

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


在下文中一共展示了Akismet::setCommentContent方法的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: detect_spam

 /**
  * Passes form content to the Akismet API. If spam is detected, sends an error message back to the user.
  */
 public function detect_spam()
 {
     $form_contents = '';
     foreach ($this->disco_form->get_values() as $k => $v) {
         if (is_array($v)) {
             $form_contents .= implode($v, ' ') . ' ';
         } else {
             // don't include hidden elements which contain objects as values
             if (!(get_class($this->disco_form->get_element($k)) == 'hiddenType' && substr($v, 0, 3) == 'id_')) {
                 $form_contents .= $v . ' ';
             }
         }
     }
     $akismet_api_key = constant("AKISMET_API_KEY");
     if (!empty($akismet_api_key)) {
         $url = carl_construct_link();
         //$akismet = new Akismet($url, $akismet_api_key, $is_test=1); // for testing
         $akismet = new Akismet($url, $akismet_api_key);
         $akismet->setCommentContent($form_contents);
         //$akismet->setCommentAuthor('viagra-test-123'); // for testing
         if ($akismet->isCommentSpam()) {
             $this->disco_form->set_error(NULL, 'Spam detected in this submission. If this message was made in error, please contact an administrator.', $element_must_exist = false);
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:akismet.php

示例4: 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

示例5: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $input = $this->all();
     // service Aksimet checked content and email
     \Akismet::setCommentContent($input['content'])->setCommentAuthorEmail($input['email']);
     $input['spam'] = \Akismet::isSpam() ? 1 : 0;
     $this->replace($input);
     return ['email' => 'email|required', 'content' => 'required', 'post_id' => 'integer', 'published_at' => 'regex:/[0-9]{4}\\-[0-9]{2}\\-[0-9]{2} [0-9]{2}\\:[0-9]{2}\\:[0-9]{2}/'];
 }
开发者ID:Antoine07,项目名称:student,代码行数:14,代码来源:CommentFormRequest.php

示例6: 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

示例7: 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

示例8: sendContact

 /**
  * @param ContactFormRequest $request
  * @return \Illuminate\Http\RedirectResponse
  *
  * PAGE CONTACT - SEND MESSAGE
  */
 public function sendContact(ContactFormRequest $request)
 {
     $messageMain = $request->input('message');
     $email = $request->input('email');
     \Akismet::setCommentContent($request->input('message'))->setCommentAuthorEmail($request->input('email'))->setCommentAuthorUrl($request->url());
     if (\Akismet::isSpam()) {
         return redirect()->back()->with('error', 'Message considéré comme du spam ! Merci d\'envoyer un message sans intentions commerciales');
     } else {
         Mail::send('emails.email', compact('messageMain', 'email'), function ($message) use($request) {
             $message->from('hicode@hicode.fr', 'Laravel');
             $message->to('pierremartin.pro@gmail.com')->cc('bar@exemple.com');
         });
         return redirect()->back()->with('message', 'Message envoyé');
     }
 }
开发者ID:PierreMartin,项目名称:starwars,代码行数:21,代码来源:FrontController.php

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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