private function Cleantalk::filterRequest in Anti Spam by CleanTalk 7.4
Same name and namespace in other branches
- 7.5 src/Cleantalk.php \Cleantalk::filterRequest()
- 7 cleantalk.module \Cleantalk::filterRequest()
- 7.2 cleantalk.module \Cleantalk::filterRequest()
Filter request params
Parameters
CleantalkRequest $request:
Return value
type
3 calls to Cleantalk::filterRequest()
- Cleantalk::isAllowMessage in src/
Cleantalk.php - Function checks whether it is possible to publish the message
- Cleantalk::isAllowUser in src/
Cleantalk.php - Function checks whether it is possible to publish the message
- Cleantalk::sendFeedback in src/
Cleantalk.php - Function sends the results of manual moderation
File
- src/
Cleantalk.php, line 150
Class
- Cleantalk
- Cleantalk Base class
Code
private function filterRequest(CleantalkRequest $request) {
// general and optional
foreach ($request as $param => $value) {
if (in_array($param, array(
'message',
'example',
'agent',
'sender_info',
'sender_nickname',
'post_info',
'phone',
)) && !empty($value)) {
if (!is_string($value) && !is_integer($value)) {
$request->{$param} = NULL;
}
}
if (in_array($param, array(
'stoplist_check',
'allow_links',
)) && !empty($value)) {
if (!in_array($value, array(
1,
2,
))) {
$request->{$param} = NULL;
}
}
if (in_array($param, array(
'js_on',
)) && !empty($value)) {
if (!is_integer($value)) {
$request->{$param} = NULL;
}
}
if ($param == 'sender_ip' && !empty($value)) {
if (!is_string($value)) {
$request->{$param} = NULL;
}
}
if ($param == 'sender_email' && !empty($value)) {
if (!is_string($value)) {
$request->{$param} = NULL;
}
}
if ($param == 'submit_time' && !empty($value)) {
if (!is_int($value)) {
$request->{$param} = NULL;
}
}
}
return $request;
}