protected function Cookie::get_variable in Anti Spam by CleanTalk 9.1.x
Same name and namespace in other branches
- 8.4 src/lib/Cleantalk/Common/Variables/Cookie.php \Cleantalk\Common\Variables\Cookie::get_variable()
* Gets given $_COOKIE variable and save it to memory *
Parameters
$name: * * @return mixed|string
Overrides SuperGlobalVariables::get_variable
File
- src/
lib/ Cleantalk/ Common/ Variables/ Cookie.php, line 22
Class
- Cookie
- Class Cookie Safety handler for $_COOKIE
Namespace
Cleantalk\Common\VariablesCode
protected function get_variable($name, $do_decode = true) {
// Return from memory. From $this->variables
if (isset(static::$instance->variables[$name])) {
return static::$instance->variables[$name];
}
if (function_exists('filter_input')) {
$value = filter_input(INPUT_COOKIE, $name);
}
if (empty($value)) {
$value = isset($_COOKIE[$name]) ? $_COOKIE[$name] : '';
}
$value = $do_decode ? urldecode($value) : $value;
return $value;
}