Elgg  Version 5.1
input.php
Go to the documentation of this file.
1 <?php
20 function get_input(string $variable, $default = null, bool $filter_result = true) {
21  return _elgg_services()->request->getParam($variable, $default, $filter_result);
22 }
23 
34 function set_input(string $variable, $value): void {
35  _elgg_services()->request->setParam($variable, $value, true);
36 }
37 
50 function elgg_get_request_data(bool $filter_result = true): array {
51  return _elgg_services()->request->getParams($filter_result);
52 }
53 
63 function elgg_get_title_input(string $variable = 'title', string $default = ''): string {
64  $raw_input = get_input($variable, $default, false);
65  return htmlspecialchars($raw_input ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
66 }
67 
78  return elgg_trigger_event_results('sanitize', 'input', [], $input);
79 }
80 
89 function elgg_is_valid_email(string $address): bool {
90  return _elgg_services()->accounts->isValidEmail($address);
91 }
92 
105 function elgg_make_sticky_form(string $form_name, array $ignored_field_names = []): void {
106  _elgg_services()->stickyForms->makeStickyForm($form_name, $ignored_field_names);
107 }
108 
121 function elgg_clear_sticky_form(string $form_name): void {
122  _elgg_services()->stickyForms->clearStickyForm($form_name);
123 }
124 
133 function elgg_is_sticky_form(string $form_name): bool {
134  return _elgg_services()->stickyForms->isStickyForm($form_name);
135 }
136 
148 function elgg_get_sticky_value(string $form_name, string $variable = '', $default = null, bool $filter_result = true) {
149  return _elgg_services()->stickyForms->getStickyValue($form_name, $variable, $default, $filter_result);
150 }
151 
161 function elgg_get_sticky_values(string $form_name, bool $filter_result = true): array {
162  return _elgg_services()->stickyForms->getStickyValues($form_name, $filter_result);
163 }
164 
176 function elgg_is_empty($value): bool {
178 }
179 
193 function _elgg_htmlawed_tag_post_processor(string $tag, array|false $attributes = false): string {
194 
195  if ($attributes === false) {
196  // This is a closing tag. Prevent further processing to avoid inserting a duplicate tag
197  return "</{$tag}>";
198  }
199 
200  $attributes = (array) elgg_trigger_event_results('attributes', 'htmlawed', [
201  'attributes' => $attributes,
202  'tag' => $tag,
203  ], $attributes);
204 
205  $result = '';
206  foreach ($attributes as $attr => $value) {
207  $result .= " {$attr}=\"{$value}\"";
208  }
209 
210  return "<{$tag}{$result}>";
211 }
212 
221 function elgg_string_to_array(string $string): array {
222  $ar = explode(',', $string);
223  $ar = array_map('trim', $ar);
224  $ar = array_map('strip_tags', $ar);
225 
226  $ar = array_filter($ar, function($string) {
227  return !elgg_is_empty($string);
228  });
229 
230  $ar = array_unique($ar);
231 
232  // reset keys
233  return array_values($ar);
234 }
$default
Definition: checkbox.php:30
elgg_get_title_input(string $variable= 'title', string $default= '')
Get an HTML-escaped title from input.
Definition: input.php:63
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
elgg_clear_sticky_form(string $form_name)
Remove form submission data from the session.
Definition: input.php:121
elgg_sanitize_input($input)
Filter input from a given string based on registered events.
Definition: input.php:77
elgg_trigger_event_results(string $event, string $type, array $params=[], $returnvalue=null)
Triggers an event where it is expected that the mixed return value could be manipulated by event call...
Definition: events.php:117
elgg_string_to_array(string $string)
Takes in a comma-separated string and returns an array of uniquely trimmed and stripped strings...
Definition: input.php:221
static isEmpty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: Values.php:192
_elgg_htmlawed_tag_post_processor(string $tag, array|false $attributes=false)
Post processor for tags in htmlawed.
Definition: input.php:193
elgg_get_sticky_value(string $form_name, string $variable= '', $default=null, bool $filter_result=true)
Get a specific value from cached form submission data.
Definition: input.php:148
set_input(string $variable, $value)
Sets an input value that may later be retrieved by get_input.
Definition: input.php:34
$value
Definition: generic.php:51
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_is_empty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: input.php:176
$input
Definition: input.php:9
$tag
Definition: title.php:21
elgg_get_sticky_values(string $form_name, bool $filter_result=true)
Get all submission data cached for a form.
Definition: input.php:161
elgg_make_sticky_form(string $form_name, array $ignored_field_names=[])
Save form submission data (all GET and POST vars) into a session cache.
Definition: input.php:105
elgg_get_request_data(bool $filter_result=true)
Returns all values parsed from the current request, including $_GET and $_POST values, as well as any values set with set_input()
Definition: input.php:50
elgg_is_sticky_form(string $form_name)
Does form submission data exist for this form?
Definition: input.php:133
elgg_is_valid_email(string $address)
Validates an email address.
Definition: input.php:89
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
$attributes
Elgg AJAX loader.
Definition: ajax_loader.php:10