Moved static functions to companion object.
This commit is contained in:
parent
1815093f5f
commit
8702c6511d
4 changed files with 48 additions and 38 deletions
|
@ -3,6 +3,8 @@ package com.example;
|
|||
import net.thauvin.erik.akismet.Akismet;
|
||||
import net.thauvin.erik.akismet.AkismetComment;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class AkismetSample {
|
||||
public static void main(String[] args) {
|
||||
final Akismet akismet = new Akismet("YOUR_API_KEY", "YOUR_BLOG_URL");
|
||||
|
@ -17,6 +19,7 @@ public class AkismetSample {
|
|||
comment.setAuthor("admin");
|
||||
comment.setAuthorEmail("test@test.com");
|
||||
comment.setAuthorUrl("http://www.CheckOutMyCoolSite.com");
|
||||
comment.setDateGmt(Akismet.dateToGmt(new Date()));
|
||||
// comment.setUserRole(AkismetComment.ADMIN_ROLE);
|
||||
comment.setContent("It means a lot that you would take the time to review our software. Thanks again.");
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.example
|
|||
|
||||
import net.thauvin.erik.akismet.Akismet
|
||||
import net.thauvin.erik.akismet.AkismetComment
|
||||
import java.util.Date
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
fun main() {
|
||||
|
@ -19,6 +20,7 @@ fun main() {
|
|||
comment.author = "admin"
|
||||
comment.authorEmail = "test@test.com"
|
||||
comment.authorUrl = "http://www.CheckOutMyCoolSite.com"
|
||||
comment.dateGmt = Akismet.dateToGmt(Date())
|
||||
// comment.userRole = AkismetComment.ADMIN_ROLE
|
||||
comment.content = "It means a lot that you would take the time to review our software. Thanks again."
|
||||
|
||||
|
@ -40,7 +42,7 @@ fun main() {
|
|||
System.err.println(akismet.errorMessage)
|
||||
}
|
||||
} else {
|
||||
println("The comment is not SPAM (HAM) according to Akismet.")
|
||||
println("The comment is not SPAM according to Akismet.")
|
||||
|
||||
val hasBeenSubmitted = akismet.submitHam(comment)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue