Elgg  Version 6.0
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|int $attributes = 0): string {
194  if ($attributes === 0) {
195  // This is a closing tag. Prevent further processing to avoid inserting a duplicate tag
196  return "</{$tag}>";
197  }
198 
199  $attributes = (array) elgg_trigger_event_results('attributes', 'htmlawed', [
200  'attributes' => $attributes,
201  'tag' => $tag,
202  ], $attributes);
203 
204  $result = '';
205  foreach ($attributes as $attr => $value) {
206  $result .= " {$attr}=\"{$value}\"";
207  }
208 
209  return "<{$tag}{$result}>";
210 }
211 
220 function elgg_string_to_array(string $string): array {
221  $ar = explode(',', $string);
222  $ar = array_map('trim', $ar);
223  $ar = array_map('strip_tags', $ar);
224 
225  $ar = array_filter($ar, function($string) {
226  return !elgg_is_empty($string);
227  });
228 
229  $ar = array_unique($ar);
230 
231  // reset keys
232  return array_values($ar);
233 }
$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:220
if(!is_string($title)||$title=== '') $tag
Definition: title.php:15
static isEmpty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: Values.php:192
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
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:351
$attributes
Elgg AJAX loader.
Definition: ajax_loader.php:10
_elgg_htmlawed_tag_post_processor(string $tag, array|int $attributes=0)
Post processor for tags in htmlawed.
Definition: input.php:193