Dotclear 2.24
Loading...
Searching...
No Matches
dcSpamFilter Class Reference
Inheritance diagram for dcSpamFilter:
dcFilterAkismet dcFilterFairTrackbacks dcFilterIP dcFilterIPv6 dcFilterIpLookup dcFilterLinksLookup dcFilterWords

Public Member Functions

 __construct ()
 
 isSpam (string $type, ?string $author, ?string $email, ?string $site, ?string $ip, ?string $content, ?int $post_id, string &$status)
 
 trainFilter (string $status, string $filter, string $type, ?string $author, ?string $email, ?string $site, ?string $ip, ?string $content, dcRecord $rs)
 
 getStatusMessage (string $status, ?int $comment_id)
 
 gui (string $url)
 
 hasGUI ()
 
 guiURL ()
 
 guiLink ()
 

Data Fields

 $name
 
 $description
 
 $active = true
 
 $order = 100
 
 $auto_delete = false
 
 $help = null
 

Protected Member Functions

 setInfo ()
 

Protected Attributes

 $has_gui = false
 
 $gui_url = null
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructs a new instance.

Reimplemented in dcFilterAkismet, dcFilterIP, dcFilterIpLookup, dcFilterIPv6, and dcFilterWords.

References dcCore\app(), and setInfo().

Member Function Documentation

◆ setInfo()

setInfo ( )
protected

Sets the filter description.

Reimplemented in dcFilterAkismet, dcFilterIP, dcFilterIpLookup, dcFilterIPv6, dcFilterLinksLookup, dcFilterWords, and dcFilterFairTrackbacks.

Referenced by __construct().

◆ isSpam()

isSpam ( string  $type,
?string  $author,
?string  $email,
?string  $site,
?string  $ip,
?string  $content,
?int  $post_id,
string &  $status 
)

This method should return if a comment is a spam or not. If it returns true or false, execution of next filters will be stoped. If should return nothing to let next filters apply.

Your filter should also fill $status variable with its own information if comment is a spam.

Parameters
string$typeThe comment type (comment / trackback)
string$authorThe comment author
string$emailThe comment author email
string$siteThe comment author site
string$ipThe comment author IP
string$contentThe comment content
int$post_idThe comment post_id
string$statusThe comment status

Reimplemented in dcFilterAkismet, dcFilterIP, dcFilterIpLookup, dcFilterIPv6, dcFilterLinksLookup, dcFilterWords, and dcFilterFairTrackbacks.

◆ trainFilter()

trainFilter ( string  $status,
string  $filter,
string  $type,
?string  $author,
?string  $email,
?string  $site,
?string  $ip,
?string  $content,
dcRecord  $rs 
)

Train the antispam filter

Parameters
string$statusThe comment status
string$filterThe filter
string$typeThe comment type
string$authorThe comment author
string$emailThe comment author email
string$siteThe comment author site
string$ipThe comment author IP
string$contentThe comment content
dcRecord$rsThe comment record

Reimplemented in dcFilterAkismet.

◆ getStatusMessage()

getStatusMessage ( string  $status,
?int  $comment_id 
)

This method returns filter status message. You can overload this method to return a custom message. Message is shown in comment details and in comments list.

Parameters
string$statusThe status
int$comment_idThe comment identifier
Returns
string The status message.

Reimplemented in dcFilterAkismet, dcFilterIP, dcFilterIpLookup, dcFilterIPv6, dcFilterLinksLookup, and dcFilterWords.

References guiLink().

◆ gui()

gui ( string  $url)

This method is called when you enter filter configuration. Your class should have $has_gui property set to "true" to enable GUI.

Parameters
string$urlThe GUI url
Returns
string The GUI HTML content

Reimplemented in dcFilterIP, dcFilterIpLookup, dcFilterIPv6, and dcFilterWords.

◆ hasGUI()

hasGUI ( )

Determines if filter has a settings GUI.

Returns
bool True if gui, False otherwise.

References dcCore\app(), and dcAuth\PERMISSION_ADMIN.

◆ guiURL()

guiURL ( )

Get the filter settings GUI URL

Returns
false|string

References $gui_url.

Referenced by guiLink().

◆ guiLink()

guiLink ( )

Field Documentation

◆ $name

$name

◆ $description

$description

◆ $active

$active = true

◆ $order

$order = 100

◆ $auto_delete

$auto_delete = false

◆ $help

$help = null

◆ $has_gui

$has_gui = false
protected

◆ $gui_url

$gui_url = null
protected

Referenced by guiURL().


The documentation for this class was generated from the following file: