function spambot_sfs_request in Spambot 8
Same name and namespace in other branches
- 6.3 spambot.module \spambot_sfs_request()
- 7 spambot.module \spambot_sfs_request()
Invoke www.stopforumspam.com's api with single username, email, and/or ip.
Parameters
array $query: A keyed array of url parameters ie. ['email' => 'blah@blah.com'].
array $data: An array that will be filled with the data from www.stopforumspam.com.
Return value
bool TRUE on successful request (and $data will contain the data) FALSE otherwise.
4 calls to spambot_sfs_request()
- SpambotCacheTest::testSpambotCaching in tests/
src/ Kernel/ SpambotCacheTest.php - Tests spambot caching functionality.
- SpambotUserspamForm::checkSubmit in src/
Form/ SpambotUserspamForm.php - Function provide functional for "Check" button.
- spambot_account_is_spammer in ./
spambot.module - Checks an account to see if it's a spammer.
- spambot_user_register_form_validate in ./
spambot.module - Validate callback for user_register form.
File
- ./
spambot.module, line 424 - Main module file.
Code
function spambot_sfs_request(array $query, array &$data) {
// Map request parameters to indexed arrays.
foreach ([
'email',
'username',
'ip',
] as $field_name) {
if (isset($query[$field_name])) {
$query[$field_name] = (array) $query[$field_name];
}
}
$result = spambot_sfs_request_multiple($query, $data);
if ($result) {
// Map response data to single results.
foreach ([
'email',
'username',
'ip',
] as $field_name) {
if (!empty($data[$field_name])) {
$data[$field_name] = reset($data[$field_name]);
}
}
}
return $result;
}