Elgg  Version 5.1
Input.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Http;
4 
11 class Input {
12 
16  protected $request;
17 
23  public function __construct(Request $request) {
24  $this->request = $request;
25  }
26 
37  public function set($key, $value) {
38  $this->request->request->set($key, $value);
39  }
40 
54  public function get($key, $default = null, $filter_result = true) {
55  $result = $default;
56 
57  $this->request->getContextStack()->push('input');
58 
60  $value = $request->get($key);
61  if ($value !== null) {
62  $result = $value;
63  if ($filter_result) {
65  }
66  }
67 
68  $this->request->getContextStack()->pop();
69 
70  return $result;
71  }
72 
80  public function all($filter_result = true) {
81  $query = $this->request->query->all();
82  $attributes = $this->request->attributes->all();
83  $post = $this->request->request->all();
84 
85  $result = array_merge($query, $attributes, $post);
86 
87  if ($filter_result) {
89  }
90 
91  return $result;
92  }
93 }
$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
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:80
$value
Definition: generic.php:51
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
__construct(Request $request)
Constructor.
Definition: Input.php:23
$query
$attributes
Elgg AJAX loader.
Definition: ajax_loader.php:10