Reworked constructors to match the API.
This commit is contained in:
parent
d4d97cd40a
commit
ef74c7e5d8
5 changed files with 64 additions and 130 deletions
|
@ -6,12 +6,11 @@ import net.thauvin.erik.akismet.AkismetComment;
|
|||
public class AkismetSample {
|
||||
public static void main(String[] args) {
|
||||
final Akismet akismet = new Akismet("YOUR_API_KEY", "YOUR_BLOG_URL");
|
||||
final AkismetComment comment = new AkismetComment();
|
||||
final AkismetComment comment = new AkismetComment("127.0.0.1",
|
||||
"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6");
|
||||
|
||||
comment.setTest(true);
|
||||
|
||||
comment.setUserIp("127.0.0.1");
|
||||
comment.setUserAgent("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6");
|
||||
comment.setReferrer("http://www.google.com");
|
||||
comment.setPermalink("http://yourblogdomainname.com/blog/post=1");
|
||||
comment.setType(AkismetComment.TYPE_COMMENT);
|
||||
|
@ -21,11 +20,11 @@ public class AkismetSample {
|
|||
// comment.setUserRole(AkismetComment.ADMIN_ROLE);
|
||||
comment.setContent("It means a lot that you would take the time to review our software. Thanks again.");
|
||||
|
||||
// final ConsoleHandler consoleHandler = new ConsoleHandler();
|
||||
// consoleHandler.setLevel(Level.FINE);
|
||||
// final Logger logger = akismet.getLogger();
|
||||
// logger.addHandler(consoleHandler);
|
||||
// logger.setLevel(Level.FINE);
|
||||
// final ConsoleHandler consoleHandler = new ConsoleHandler();
|
||||
// consoleHandler.setLevel(Level.FINE);
|
||||
// final Logger logger = akismet.getLogger();
|
||||
// logger.addHandler(consoleHandler);
|
||||
// logger.setLevel(Level.FINE);
|
||||
|
||||
if (akismet.verifyKey()) {
|
||||
final boolean isSpam = akismet.checkComment(comment);
|
||||
|
|
|
@ -8,16 +8,18 @@ fun main() {
|
|||
val akismet = Akismet("YOUR_API_KEY", "YOUR_BLOG_URL")
|
||||
val comment = AkismetComment(
|
||||
userIp = "127.0.0.1",
|
||||
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6",
|
||||
referrer = "http://www.google.com",
|
||||
permalink = "http://yourblogdomainname.com/blog/post=1",
|
||||
type = AkismetComment.TYPE_COMMENT,
|
||||
author = "admin",
|
||||
authorEmail = "test@test.com",
|
||||
authorUrl = "http://www.CheckOutMyCoolSite.com",
|
||||
// userRole = AkismetComment.ADMIN_ROLE,
|
||||
content = "It means a lot that you would take the time to review our software. Thanks again.",
|
||||
isTest = true)
|
||||
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6")
|
||||
|
||||
comment.isTest = true
|
||||
|
||||
comment.referrer = "http://www.google.com"
|
||||
comment.permalink = "http://yourblogdomainname.com/blog/post=1"
|
||||
comment.type = AkismetComment.TYPE_COMMENT
|
||||
comment.author = "admin"
|
||||
comment.authorEmail = "test@test.com"
|
||||
comment.authorUrl = "http://www.CheckOutMyCoolSite.com"
|
||||
// comment.userRole = AkismetComment.ADMIN_ROLE
|
||||
comment.content = "It means a lot that you would take the time to review our software. Thanks again."
|
||||
|
||||
// with(akismet.logger) {
|
||||
// addHandler(ConsoleHandler().apply { level = Level.FINE })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue