public static function CleantalkFuncs::apbct_getcookie in Anti Spam by CleanTalk 8.3
Same name and namespace in other branches
- 8.4 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::apbct_getcookie()
- 9.1.x src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::apbct_getcookie()
Get our variables from cookies OR sessions
Parameters
$name string Name of necessary variable to get:
Return value
string|null
4 calls to CleantalkFuncs::apbct_getcookie()
- BootSubscriber::handle in src/
EventSubscriber/ BootSubscriber.php - Handles a Request to convert it to a Response.
- CleantalkFuncs::_cleantalk_apbct_cookies_test in src/
CleantalkFuncs.php - Cookie test
- CleantalkFuncs::_cleantalk_check_spam in src/
CleantalkFuncs.php - Cleantalk inner function - performs antispam checking.
- cleantalk_validate_webform in ./
cleantalk.module - Cleantalk inner function - webform validation function.
File
- src/
CleantalkFuncs.php, line 76
Class
- CleantalkFuncs
- Cleantalk class create request
Namespace
Drupal\cleantalkCode
public static function apbct_getcookie($name) {
if (\Drupal::config('cleantalk.settings')
->get('cleantalk_alternative_cookies_session') && substr($name, 0, strlen('apbct')) === 'apbct') {
// From database
$connection = \Drupal::database();
$value = $connection
->query("SELECT value FROM {cleantalk_sessions} WHERE id = :id AND name = :name", array(
':id' => self::_apbct_alt_session__id__get(),
':name' => $name,
))
->fetchField();
if (false !== $value) {
return $value;
}
else {
return null;
}
}
else {
// From cookies
if (isset($_COOKIE[$name])) {
return $_COOKIE[$name];
}
else {
return null;
}
}
}