@package MicroAkismet
@author Gaby Vanhegan
@version 1.2
@date 2007-01-29
A straightforward set of functions for talking to the Akismet blog-spam
protection system. This is intended as a simple and compact method for
adding Akismet protection to any user-submitted content. Built using the
information and examples on the Akismet API page:
http://akismet.com/development/api/
There are two versions, a bunch of static functions or a stand-alone
class. Usage is practically identical for either, you can use whichever
one you want.
INSTALLATION:
1. To begin using the functions, download and unzip the script from the
website:
http://vanhegan.net/software/akismet/
2. Place the php file you want somewhere in your web root, and load
the functions or class using:
include_once("func.microakismet.inc.php")
Or:
include_once("class.microakismet.inc.php")
3. Obtain a valid WordPress API key, if you do not already have one, from:
http://wordpress.com/
If you don't have an account you will need to create one. Once you have an
account, your API key can be found at the bottom of this page:
http://wordpress.com/profile/
4a. If you're using the static functions (func.microakismet.inc.php) then
you will need to set the global variables at the top of the file; your
WordPress API key and the home page of the blog being protected. The
User Agent can be changed to suit your application. If it is not a blog
that is being protected, change the home page to the comments page or forum
page that is being protected.
4b. If you are using the class file (func.microakismet.inc.php), the API
key, homepage and user agent are specified in the class constructor.
USAGE:
There are three functions for talking to Akismet. In the static functions:
aksimet_check( $vars ) // Check if a comment is spam or not
aksimet_spam( $vars ) // Re-classify a comment as spam
aksimet_ham( $vars ) // Re-classify a comment as ham
And the corresponding member functions in the class version:
$akismet = new MicroAkismet( $api_key, $blog, $user_agent );
$akismet->check( $vars );
$akismet->spam( $vars );
$akismet->ham( $vars );
Each function takes one argument, $vars, which is a list of information
about the comment that is being checked. $vars *must* contain at least
this information:
$vars["user_ip"] // The IP of the comment poster
$vars["user_agent"] // The user-agent of the comment poster
The "blog" value (the homepage of the blog that this post came from) is
added automatically by the code. The following extra information can also
be added, to help Akismet classify the message more accurately:
$vars["referrer"] // The content of the HTTP_REFERER header
$vars["permalink"] // Permalink to the comment
$vars["comment_type"] // May be blank, comment, trackback, etc
$vars["comment_author"] // Submitted name with the comment
$vars["comment_author_email"] // Submitted email address
$vars["comment_author_url"] // Commenter URL
$vars["comment_content"] // The content that was submitted
In PHP, you can also add the contents of the $_SERVER array to this list,
which gives extra information to Akismet, and further increases the
accuracy of their system:
EXAMPLE:
To check if a message is spam or not:
<?php
// The array of data we need
$vars = array();
// Add the contents of the $_SERVER array, to help Akismet out
foreach ( $_SERVER as $key => $val ) { $vars[ $key ] = $val; }
// Mandatory fields of information
$vars["user_ip"] = $_SERVER["REMOTE_ADDR"];
$vars["user_agent"] = $_SERVER["HTTP_USER_AGENT"];
// The body of the message to check, the name of the person who
// posted it, and their email address
$vars["comment_content"] = $_POST["comment"];
$vars["comment_author"] = $_POST["sender_name"];
$vars["comment_author_email"] = $_POST["sender_email"];
// ... Add more fields if you want
// Check if it's spam
if ( akismet_check( $vars ) ) {
die( "The message was spam!" );
}
else {
// ...
// Do whatever we do if the message was OK
}
?>
Or to do this using the class version:
<?php
// The array of data we need
$vars = array();
// ... Add vars as before ...
$akismet = new MicroAkismet( "your.wordpress.api.key",
"http://homepaeg.com/blog/comments",
"mysite.com/1.0" );
// Check if it's spam
if ( $akismet->check( $vars ) ) {
die( "The message was spam!" );
}
else {
// Do whatever we do if the message was OK
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源内容:项目全套源码+完整文档 源码说明: 全部项目源码都是经过测试校正后百分百成功运行。 SpringBoot 毕业设计,SpringBoot 课程设计,基于SpringBoot+Vue开发的,含有代码注释,新手也可看懂。ssm整合开发,小程序毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 项目都经过严格调试,确保可以运行! 1. 技术组成 前端:Vue/JSP/React/HTML+JS+CSS/ASP 后台框架代码:java/c/c++/php/VB/lun/Andorid/Python 开发环境:idea 数据库:MySql(建议用 5.7,8.0 有时候会有坑) 部署环境:Tomcat(建议用 7.x 或者 8.x b版本),maven Spring root vue.js
资源推荐
资源详情
资源评论
收起资源包目录
【php+mysql+毕业设计源代码】JibberBook_jibberbook.rar (269个子文件)
style.css 3KB
jbastyle.css 3KB
style.css 3KB
style.css 3KB
style.css 3KB
style_js.css 394B
style_js.css 388B
style_js.css 387B
style_js.css 381B
jbastyle_js.css 368B
ConfigForm.css 301B
middle_bg.gif 2KB
bottom_bg.gif 1KB
happy.gif 944B
love.gif 942B
squiggle.gif 942B
gasp.gif 941B
sad.gif 940B
blush.gif 940B
yesh.gif 940B
yell.gif 940B
biggrin.gif 938B
razz.gif 937B
smile.gif 937B
kawaii.gif 937B
numnum.gif 937B
dead.gif 936B
angry.gif 936B
squee.gif 935B
frustrated.gif 935B
blank.gif 934B
hmph.gif 934B
shifty.gif 934B
blah.gif 933B
wink.gif 933B
huh.gif 933B
befuddled.gif 929B
sigh.gif 927B
footer_bg.gif 522B
header_bg.gif 520B
button.gif 515B
header_bg.gif 218B
wave.gif 213B
excited.gif 195B
jawdrop.gif 195B
sweatdropsmile.gif 193B
sweatdropworried.gif 189B
sob.gif 187B
headache.gif 187B
lol.gif 185B
fuss.gif 182B
cry.gif 182B
argggh.gif 180B
template.gif 168B
c_header_bg.gif 152B
content_bg.gif 146B
footer_bg.gif 146B
content_bg.gif 146B
footer_bg.gif 146B
header_bg.gif 141B
header_bg.gif 141B
h3_bg.gif 111B
h3_bg.gif 111B
c_header_bg.gif 97B
content_bg.gif 93B
content_bg.gif 77B
body_bg.gif 70B
info.ini 45B
jbscript.js 8KB
jbascript.js 3KB
ConfigForm.js 142B
HTMLPurifier.standalone.php 515KB
PH5P.php 161KB
ConfigForm.php 13KB
HTMLDefinition.php 10KB
Validator.php 8KB
id.php 6KB
comments.class.php 6KB
InterchangeBuilder.php 6KB
comments.class.php 5KB
Printer.php 5KB
class.microakismet.inc.php 5KB
ExtractStyleBlocks.php 5KB
func.microakismet.inc.php 4KB
en.php 4KB
Xml.php 4KB
ru.php 4KB
bg.php 4KB
index.php 4KB
uk.php 3KB
validateform.php 3KB
fa.php 3KB
PEARSax3.php 3KB
ar.php 3KB
no.php 3KB
ja.php 3KB
add.php 3KB
de.php 3KB
cs.php 3KB
fr.php 3KB
共 269 条
- 1
- 2
- 3
资源评论
程序员小马软件开发定制
- 粉丝: 8443
- 资源: 2245
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功