protected function Get::get_variable in Anti Spam by CleanTalk 9.1.x
Same name and namespace in other branches
- 8.4 src/lib/Cleantalk/Common/Variables/Get.php \Cleantalk\Common\Variables\Get::get_variable()
* Gets given $_GET variable and save it to memory * *
Parameters
string $name: * @param bool $do_decode * * @return mixed|string
Overrides SuperGlobalVariables::get_variable
File
- src/
lib/ Cleantalk/ Common/ Variables/ Get.php, line 24
Class
- Get
- Class Get Safety handler for $_GET
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_GET, $name);
}
if (empty($value)) {
$value = isset($_GET[$name]) ? $_GET[$name] : '';
}
$value = $do_decode ? urldecode($value) : $value;
// Remember for further calls
static::getInstance()
->remember_variable($name, $value);
return $value;
}