yf_input classCore input.
| File | plugins/sys/classes/yf_input.class.php |
|---|---|
| Use | _class('input') |
| Property | Default | Description |
|---|---|---|
| None declared in this class. | ||
public function cookie($key = null, $val = null)
Helper to get/set COOKIE vars.
public function env($key = null, $val = null)
Helper to get/set ENV vars.
public function env($key = null, $val = null)
{
if ($val !== null) {
$_ENV[$key] = $val;
}
if (DEBUG_MODE && function_exists('debug')) {
debug('input_' . __FUNCTION__ . '[]', [
'name' => $key,
'val' => $val,
'op' => $val !== null ? 'set' : 'get',
'trace' => main()->trace_string(),
]);
}
return $key === null ? $_ENV : ($_ENV[$key] ?? null);
}
public function get($key = null, $val = null)
Helper to get/set GET vars.
public function get($key = null, $val = null)
{
if ($val !== null) {
$_GET[$key] = $val;
}
if (DEBUG_MODE && function_exists('debug')) {
debug('input_' . __FUNCTION__ . '[]', [
'name' => $key,
'val' => $val,
'op' => $val !== null ? 'set' : 'get',
'trace' => main()->trace_string(),
]);
}
return $key === null ? $_GET : ($_GET[$key] ?? null);
}
public function is_ajax()
Checks whether current page was requested with AJAX.
public function is_ajax()
{
return (bool) main()->is_ajax();
}
public function is_console()
Checks whether current page was requested from console.
public function is_console()
{
return (bool) main()->is_console();
}
public function is_post()
Checks whether current page was requested with POST method.
public function is_post()
{
return (bool) main()->is_post();
}
public function is_redirect()
Checks whether current page is a redirect.
public function is_redirect()
{
return (bool) main()->is_redirect();
}
public function post($key = null, $val = null)
Helper to get/set POST vars.
public function post($key = null, $val = null)
{
if ($val !== null) {
$_POST[$key] = $val;
}
if (DEBUG_MODE && function_exists('debug')) {
debug('input_' . __FUNCTION__ . '[]', [
'name' => $key,
'val' => $val,
'op' => $val !== null ? 'set' : 'get',
'trace' => main()->trace_string(),
]);
}
return $key === null ? $_POST : ($_POST[$key] ?? null);
}
public function server($key = null, $val = null)
Helper to get/set SERVER vars.
public function server($key = null, $val = null)
{
if ($val !== null) {
$_SERVER[$key] = $val;
}
if (DEBUG_MODE && function_exists('debug')) {
debug('input_' . __FUNCTION__ . '[]', [
'name' => $key,
'val' => $val,
'op' => $val !== null ? 'set' : 'get',
'trace' => main()->trace_string(),
]);
}
return $key === null ? $_SERVER : ($_SERVER[$key] ?? null);
}
public function session($key = null, $val = null)
Helper to get/set SESSION vars.
public function session($key = null, $val = null)
{
if ($val !== null) {
$_SESSION[$key] = $val;
}
if (DEBUG_MODE && function_exists('debug')) {
debug('input_' . __FUNCTION__ . '[]', [
'name' => $key,
'val' => $val,
'op' => $val !== null ? 'set' : 'get',
'trace' => main()->trace_string(),
]);
}
return $key === null ? $_SESSION : ($_SESSION[$key] ?? null);
}
_ hooks and helpers; not routable as page actionspublic function __call($name, $args)
Catch missing method call.
public function __call($name, $args)
{
return main()->extend_call($this, $name, $args);
}