public static function CleantalkFuncs::apbct_getcookie in Anti Spam by CleanTalk 8.4
Same name and namespace in other branches
- 8.3 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
7 calls to CleantalkFuncs::apbct_getcookie()
- AntiCrawler::check in src/
lib/ Cleantalk/ Common/ Firewall/ Modules/ AntiCrawler.php - Use this method to execute main logic of the module.
- AntiFlood::check in src/
lib/ Cleantalk/ Common/ Firewall/ Modules/ AntiFlood.php - Use this method to execute main logic of the module.
- 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.
File
- src/
CleantalkFuncs.php, line 112
Class
- CleantalkFuncs
- Cleantalk class create request
Namespace
Drupal\cleantalkCode
public static function apbct_getcookie($name) {
if (\Drupal::config('cleantalk.settings')
->get('cleantalk_set_cookies')) {
if (\Drupal::config('cleantalk.settings')
->get('cleantalk_alternative_cookies_session')) {
// 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;
}
}
}
return null;
}