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


PHP Akismet::setCommentAuthorURL方法代码示例

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


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

示例1:

 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

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

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

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

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

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

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

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

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

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

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

示例12: getAkismet

 protected function getAkismet($invoker)
 {
     $request = sfContext::getInstance()->getRequest();
     $api_key = sfConfig::get('app_akismet_api_key');
     if (empty($api_key)) {
         return false;
     }
     $akismet = new Akismet($request->getUriPrefix() . $request->getRelativeUrlRoot(), $api_key);
     $data = $invoker->getAkismetData();
     // Set values
     if (!empty($data['author_name'])) {
         $akismet->setCommentAuthor($data['author_name']);
     } else {
         return true;
     }
     if (!empty($data['author_email'])) {
         $akismet->setCommentAuthorEmail($data['author_email']);
     }
     if (!empty($data['author_url'])) {
         $akismet->setCommentAuthorURL($data['author_url']);
     }
     if (!empty($data['content'])) {
         $akismet->setCommentContent($data['content']);
     } else {
         return true;
     }
     if (!empty($data['permalink'])) {
         $akismet->setPermalink($data['permalink']);
     }
     if (!empty($data['referrer'])) {
         $akismet->setReferer($data['referrer']);
     }
     if (!empty($data['user_ip'])) {
         $akismet->setUserIp($data['user_ip']);
     }
     return $akismet;
 }
开发者ID:jeremyfa,项目名称:dmAkismetPlugin,代码行数:37,代码来源:DmAkismet.php

示例13: intval

    function delete_comment()
    {
        // Lock this shit down!!!
        if ($this->user['user_level'] < USER_PRIVILEGED) {
            return $this->module->error('Access Denied: You do not have permission to perform that action.');
        }
        if (!isset($this->module->get['c'])) {
            return $this->module->message('Delete Comment', 'No comment was specified for editing.');
        }
        $c = intval($this->module->get['c']);
        $comment = $this->db->quick_query('SELECT c.*, u.* FROM %pblogcomments c
			LEFT JOIN %pusers u ON u.user_id=c.comment_user	WHERE comment_id=%d', $c);
        if (!$comment) {
            return $this->module->message('Delete Comment', 'No such comment was found for deletion.');
        }
        if ($this->user['user_id'] != $comment['comment_user'] && $this->user['user_level'] < USER_CONTRIBUTOR) {
            return $this->module->error('Access Denied: You do not own the comment you are attempting to delete.');
        }
        // After 3 hours, you're stuck with it if you're a regular member.
        if ($this->user['user_level'] == USER_PRIVILEGED && $this->module->time - $comment['comment_date'] > 10800) {
            return $this->module->error('Access Denied: You cannot delete your comments after 3 hours have gone by.');
        }
        $user = null;
        if ($comment['comment_type'] == COMMENT_BLOG) {
            $user = $this->db->quick_query('SELECT post_user FROM %pblogposts WHERE post_id=%d', $comment['comment_post']);
        } elseif ($comment['comment_type'] == COMMENT_GALLERY) {
            $user = $this->db->quick_query('SELECT photo_user FROM %pphotogallery WHERE photo_id=%d', $comment['comment_post']);
        } elseif ($comment['comment_type'] == COMMENT_FILE) {
            $user = $this->db->quick_query('SELECT file_user FROM %pfilelist WHERE file_id=%d', $comment['comment_post']);
        }
        if (!$user) {
            return $this->module->error('Access Denied: You do not own the entry you are trying to edit.');
        }
        if ($this->user['user_level'] == USER_CONTRIBUTOR) {
            switch ($comment['comment_type']) {
                case COMMENT_BLOG:
                    if ($this->user['user_id'] != $user['post_user'] && $this->user['user_id'] != $comment['comment_user']) {
                        return $this->module->error('Access Denied: You do not own the blog entry you are trying to edit.');
                    }
                    break;
                case COMMENT_GALLERY:
                    if ($this->user['user_id'] != $user['photo_user'] && $this->user['user_id'] != $comment['comment_user']) {
                        return $this->module->error('Access Denied: You do not own the image entry you are trying to edit.');
                    }
                    break;
                case COMMENT_FILE:
                    if ($this->user['user_id'] != $user['file_user'] && $this->user['user_id'] != $comment['comment_user']) {
                        return $this->module->error('Access Denied: You do not own the download entry you are trying to edit.');
                    }
                    break;
                default:
                    return $this->module->error('Unknown comment type selected for editing.');
            }
        }
        if (isset($this->module->get['t']) && $this->module->get['t'] == 'spam') {
            if ($this->user['user_level'] < USER_CONTRIBUTOR) {
                return $this->module->error('Access Denied: You are not authorized to report spam.');
            }
        }
        $page = '';
        if ($comment['comment_type'] == COMMENT_BLOG) {
            $page = 'blog';
        } elseif ($comment['comment_type'] == COMMENT_GALLERY) {
            $page = 'gallery';
        } elseif ($comment['comment_type'] == COMMENT_FILE) {
            $page = 'downloads';
        }
        if (!isset($this->module->get['confirm'])) {
            $author = htmlspecialchars($comment['user_name']);
            $params = POST_BBCODE | POST_EMOTICONS;
            $text = $this->module->format($comment['comment_message'], $params);
            $date = date($this->settings['blog_dateformat'], $comment['comment_date']);
            $msg = "<div class=\"title\">Comment by {$author} Posted on: {$date}</div><div class=\"article\">{$text}</div>";
            $link = "index.php?a={$page}&amp;s=del_comment&amp;c={$c}&amp;confirm=1";
            $sp = null;
            if (isset($this->module->get['t']) && $this->module->get['t'] == 'spam') {
                $link .= '&amp;t=spam';
                $sp = '<br />This comment will be reported as spam.';
            }
            $msg .= "<div class=\"title\" style=\"text-align:center\">Are you sure you want to delete this comment?{$sp}</div>";
            return $this->module->message('DELETE COMMENT', $msg, 'Delete', $link, 0);
        }
        $out = null;
        if (isset($this->module->get['t']) && $this->module->get['t'] == 'spam') {
            // Time to report the spammer before we delete the comment. Hopefully this is enough info to strike back with.
            require_once 'lib/akismet.php';
            $akismet = new Akismet($this->settings['site_address'], $this->settings['wordpress_api_key'], $this->module->version);
            $akismet->setCommentAuthor($comment['user_name']);
            $akismet->setCommentAuthorURL($comment['user_url']);
            $akismet->setCommentContent($comment['comment_message']);
            $akismet->setUserIP($comment['comment_ip']);
            $akismet->setReferrer($comment['comment_referrer']);
            $akismet->setCommentUserAgent($comment['comment_agent']);
            $akismet->setCommentType('comment');
            $akismet->submitSpam();
            $this->settings['spam_count']++;
            $this->settings['spam_uncaught']++;
            $this->module->save_settings();
            $out .= 'Comment tagged as spam and reported.<br />';
        }
//.........这里部分代码省略.........
开发者ID:biggtfish,项目名称:Sandbox,代码行数:101,代码来源:comments.php

示例14: foreach

 if (isset($_POST['spam']) and !empty($_POST['pilihan'])) {
     # Panggil classAkismet
     require_once $this->direktori_kiss . '/classAkismet.php';
     foreach ($_POST['pilihan'] as $id_komentar) {
         $id_komen = $this->filter($id_komentar);
         # Jangan tampilkan komentar dari konten yang bersangkutan
         $proses = $this->db->perbarui('komentar', "aktif = 0", "id = '{$id_komentar}'");
         if ($proses) {
             # Ambil data komentar
             $komen_spam = $this->db->ambil('komentar', 'komentar, nama, email, situs', "id = '{$id_komentar}'");
             # Proses dengan Akismet (submit ke server Akismet sebagai SPAM)
             $akismet = new Akismet($this->alamat, $this->data_utama['wordpress_key']);
             $akismet->setCommentAuthor($komen_spam['nama']);
             $akismet->setCommentAuthorEmail($komen_spam['email']);
             if (!empty($komen_spam['situs'])) {
                 $akismet->setCommentAuthorURL($komen_spam['situs']);
             }
             $akismet->setCommentContent($komen_spam['komentar']);
             $akismet->submitSpam();
         }
     }
     $komen .= 'Komentar telah ditandai sebagai SPAM';
 } elseif (isset($_POST['hapus']) and !empty($_POST['pilihan'])) {
     $num = 0;
     foreach ($_POST['pilihan'] as $id_komentar) {
         $id_komentar = $this->filter($id_komentar);
         $proses = $this->db->hapus('komentar', "id = '{$id_komentar}'");
         $num++;
     }
     $konten .= $proses ? 'Menghapus ' . $num . ' komentar' : 'Gagal menghapus komentar';
 }
开发者ID:jenggo,项目名称:KISS,代码行数:31,代码来源:administrasi.php

示例15: addMonial

 function addMonial()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.utilities.utility');
     JRequest::checkToken() or jexit('Invalid Token');
     $app = JFactory::getApplication();
     $db =& JFactory::getDBO();
     $document =& JFactory::getDocument();
     require_once JPATH_COMPONENT . DS . 'assets' . DS . '3rdparty' . DS . 'SimpleImage.php';
     $myparams =& JComponentHelper::getParams('com_eztestimonial');
     $imageSubFolder = $myparams->getValue('data.params.imagefolder');
     $autoApprove = $myparams->getValue('data.params.autoapprove', 0);
     $uploadSize = $myparams->getValue('data.params.imagesize', 400);
     $spamfilter = $myparams->getValue('data.params.spamfilter');
     $sendemailtouser = $myparams->getValue('data.params.sendemailtouser', 0);
     $sendemailtoadmin = $myparams->getValue('data.params.sendemailtoadmin', 0);
     $summerytxtlength = $myparams->getValue('data.params.summerytxtlength', 100);
     $ImgUrl = JRoute::_(JURI::base() . 'images/' . $imageSubFolder . '/');
     $returnUrl = JRoute::_("index.php?option=com_eztestimonial&view=testimonials");
     $valid = true;
     $fullname = strip_tags(JRequest::getVar('iname'));
     $useremail = strip_tags(JRequest::getVar('iemail'));
     $location = strip_tags(JRequest::getVar('iaddress'));
     $website = strip_tags(JRequest::getVar('iwebsite'));
     $message = strip_tags(JRequest::getVar('imessage'));
     $aboutme = strip_tags(JRequest::getVar('iboutme'));
     $rating = JRequest::getVar('rating');
     $file = JRequest::getVar('iimage', null, 'files', 'array');
     $filename = JFile::makeSafe($file['name']);
     $src = $file['tmp_name'];
     $extension_of_image = testimonialController::get_extension(strtolower($filename));
     //get the extension of image
     $FileSize = filesize($file['tmp_name']);
     $AllowedSize = $uploadSize * 1048576;
     if ($spamfilter == 1) {
         $privatekey = $myparams->getValue('data.params.reprivatekey');
         require_once JPATH_COMPONENT . DS . 'assets' . DS . '3rdparty' . DS . 'recaptchalib.php';
         $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         if (!$resp->is_valid) {
             $app->enqueueMessage(JText::_('COM_TESTIMONIALS_WRONGRECAPTCHA'), 'error');
             $valid = false;
         }
     } elseif ($spamfilter == 2) {
         $akismetKey = $myparams->getValue('data.params.akismetKey');
         require_once JPATH_COMPONENT . DS . 'assets' . DS . '3rdparty' . DS . 'Akismet.class.php';
         $MyURL = JURI::base();
         $akismet = new Akismet($MyURL, $akismetKey);
         $akismet->setCommentAuthor($fullname);
         $akismet->setCommentAuthorEmail($email);
         $akismet->setCommentAuthorURL($website);
         $akismet->setCommentContent($message);
         $akismet->setPermalink(JURI::current());
         if ($akismet->isCommentSpam()) {
             die("spam alert!");
             $valid = false;
         }
     }
     if ($FileSize > $AllowedSize) {
         $exceededtxt = JText::sprintf(JText::_('COM_TESTIMONIALS_IMAGESIZETOOBIG'), testimonialController::format_bytes($AllowedSize), testimonialController::format_bytes($FileSize));
         $app->enqueueMessage($exceededtxt, 'error');
         $valid = false;
     }
     if (strlen($FileSize) <= 1 && strlen($filename) > 1) {
         $app->enqueueMessage(JText::_('COM_TESTIMONIALS_ERRUPLOADING'), 'error');
         $valid = false;
     }
     if ($FileSize > 1 && $valid == true) {
         // Import image
         switch ($extension_of_image) {
             case 'jpg':
             case 'jpeg':
             case 'png':
             case 'gif':
                 break;
             default:
                 // Unsupported format
                 $app->enqueueMessage(JText::_('COM_TESTIMONIALS_FILENOTSUPPORTED'), 'error');
                 $valid = false;
                 break;
         }
     }
     if ($FileSize > 1 && $valid == true) {
         $random_str = testimonialController::random_str();
         $photo_name = strtolower(str_replace(" ", "-", htmlspecialchars($fullname))) . "-" . $random_str . ".";
         // cleaned photo name with random charactor
         $newPhotoname = $photo_name . $extension_of_image;
         $newPhotoPath = JPATH_BASE . DS . "images" . DS . $imageSubFolder . DS;
         $thumb_dest = $newPhotoPath . 'thumb_' . $newPhotoname;
         $thumb_dest50 = $newPhotoPath . 'thumb50_' . $newPhotoname;
         $dest = $newPhotoPath . $newPhotoname;
         $image = new SimpleImage();
         $image->square_crop($file['tmp_name'], $thumb_dest, $thumb_size = 200, $jpg_quality = 90);
         $image->square_crop($file['tmp_name'], $thumb_dest50, $thumb_size = 50, $jpg_quality = 90);
         $image->load($file['tmp_name']);
         //$image->resizeToWidth(600);
         $image->save($dest);
     } else {
         $newPhotoname = '';
     }
     if (strlen($fullname) < 2) {
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:controller.php


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