Elgg  Version master
Input.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Http;
4 
11 class Input {
12 
18  public function __construct(protected Request $request) {
19  }
20 
31  public function set($key, $value) {
32  $this->request->request->set($key, $value);
33  }
34 
48  public function get($key, $default = null, $filter_result = true) {
49  $result = $default;
50 
51  $this->request->getContextStack()->push('input');
52 
54  $value = $request->get($key);
55  if ($value !== null) {
56  $result = $value;
57  if ($filter_result) {
59  }
60  }
61 
62  $this->request->getContextStack()->pop();
63 
64  return $result;
65  }
66 
74  public function all($filter_result = true) {
75  $query = $this->request->query->all();
76  $attributes = $this->request->attributes->all();
77  $post = $this->request->request->all();
78 
79  $result = array_merge($query, $attributes, $post);
80 
81  if ($filter_result) {
83  }
84 
85  return $result;
86  }
87 }
$default
Definition: checkbox.php:30
Elgg HTTP request.
Definition: Request.php:17
Provides unified access to the $_GET and $_POST inputs.
Definition: Input.php:11
$request
Definition: livesearch.php:12
elgg_sanitize_input($input)
Filter input from a given string based on registered events.
Definition: input.php:77
all($filter_result=true)
Returns all values parsed from the request.
Definition: Input.php:74
__construct(protected Request $request)
Constructor.
Definition: Input.php:18
$value
Definition: generic.php:51
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
$query
$attributes
Elgg AJAX loader.
Definition: ajax_loader.php:10