Elgg  Version 6.1
Functions
input.php File Reference

Go to the source code of this file.

Functions

 get_input (string $variable, $default=null, bool $filter_result=true)
 Parameter input functions. More...
 
 set_input (string $variable, $value)
 Sets an input value that may later be retrieved by get_input. More...
 
 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() More...
 
 elgg_get_title_input (string $variable= 'title', string $default= '')
 Get an HTML-escaped title from input. More...
 
 elgg_sanitize_input ($input)
 Filter input from a given string based on registered events. More...
 
 elgg_is_valid_email (string $address)
 Validates an email address. More...
 
 elgg_make_sticky_form (string $form_name, array $ignored_field_names=[])
 Save form submission data (all GET and POST vars) into a session cache. More...
 
 elgg_clear_sticky_form (string $form_name)
 Remove form submission data from the session. More...
 
 elgg_is_sticky_form (string $form_name)
 Does form submission data exist for this form? More...
 
 elgg_get_sticky_value (string $form_name, string $variable= '', $default=null, bool $filter_result=true)
 Get a specific value from cached form submission data. More...
 
 elgg_get_sticky_values (string $form_name, bool $filter_result=true)
 Get all submission data cached for a form. More...
 
 elgg_is_empty ($value)
 Check if a value isn't empty, but allow 0 and '0'. More...
 
 _elgg_htmlawed_tag_post_processor (string $tag, array|int $attributes=0)
 Post processor for tags in htmlawed. More...
 
 elgg_string_to_array (string $string)
 Takes in a comma-separated string and returns an array of uniquely trimmed and stripped strings. More...
 

Function Documentation

_elgg_htmlawed_tag_post_processor ( string  $tag,
array|int  $attributes = 0 
)

Post processor for tags in htmlawed.

This runs after htmlawed has filtered. It runs for each tag and allows sanitization of attributes.

This function triggers the 'attributes', 'htmlawed' event.

Parameters
string$tagThe tag element name
array | int$attributesAn array of attributes (int 0 indicates a closing tag)
Returns
string

Definition at line 193 of file input.php.

elgg_clear_sticky_form ( string  $form_name)

Remove form submission data from the session.

Call this if validation is successful in the action handler or when they sticky values have been used to repopulate the form after a validation error.

Parameters
string$form_nameForm namespace
Returns
void
Since
1.8.0

Definition at line 121 of file input.php.

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()

See also
get_input()
set_input()
Parameters
bool$filter_resultSanitize input values
Returns
array
Since
3.0

Definition at line 50 of file input.php.

elgg_get_sticky_value ( string  $form_name,
string  $variable = '',
  $default = null,
bool  $filter_result = true 
)

Get a specific value from cached form submission data.

Parameters
string$form_nameThe name of the form
string$variableThe name of the variable
mixed$defaultDefault value if the variable does not exist in sticky cache
boolean$filter_resultFilter for bad input if true
Returns
mixed
Since
1.8.0

Definition at line 148 of file input.php.

elgg_get_sticky_values ( string  $form_name,
bool  $filter_result = true 
)

Get all submission data cached for a form.

Parameters
string$form_nameThe name of the form
bool$filter_resultFilter for bad input if true
Returns
array
Since
1.8.0

Definition at line 161 of file input.php.

elgg_get_title_input ( string  $variable = 'title',
string  $default = '' 
)

Get an HTML-escaped title from input.

E.g. "How to use <b> tags"

Parameters
string$variableThe desired variable name
string$defaultThe default if none given
Returns
string
Since
3.0

Definition at line 63 of file input.php.

elgg_is_empty (   $value)

Check if a value isn't empty, but allow 0 and '0'.

Parameters
mixed$valuethe value to check
See also
empty()
Elgg::isEmpty()
Returns
bool
Since
3.0.0
Examples:
/root/Elgg/engine/classes/Elgg/Http/Urls.php.

Definition at line 176 of file input.php.

elgg_is_sticky_form ( string  $form_name)

Does form submission data exist for this form?

Parameters
string$form_nameForm namespace
Returns
boolean
Since
1.8.0

Definition at line 133 of file input.php.

elgg_is_valid_email ( string  $address)

Validates an email address.

Parameters
string$addressEmail address.
Returns
bool
Since
4.3

Definition at line 89 of file input.php.

elgg_make_sticky_form ( string  $form_name,
array  $ignored_field_names = [] 
)

Save form submission data (all GET and POST vars) into a session cache.

Call this from an action when you want all your submitted variables available if the submission fails validation and is sent back to the form

Parameters
string$form_nameName of the sticky form
string[]$ignored_field_names Field names which shouldn't be made sticky in this form
Returns
void
Since
1.8.0

Definition at line 105 of file input.php.

elgg_sanitize_input (   $input)

Filter input from a given string based on registered events.

Parameters
mixed$inputAnything that does not include an object (strings, ints, arrays) This includes multi-dimensional arrays.
Returns
mixed The filtered result
Since
4.3

Definition at line 77 of file input.php.

elgg_string_to_array ( string  $string)

Takes in a comma-separated string and returns an array of uniquely trimmed and stripped strings.

Parameters
string$stringComma-separated string
Returns
array
Since
4.3

Definition at line 220 of file input.php.

get_input ( string  $variable,
  $default = null,
bool  $filter_result = true 
)

Parameter input functions.

This file contains functions for getting input from get/post variables. Get some input from variables passed submitted through GET or POST.

If using any data obtained from get_input() in a web page, please be aware that it is a possible vector for a reflected XSS attack. If you are expecting an integer, cast it to an int. If it is a string, escape quotes.

Parameters
string$variableThe variable name we want.
mixed$defaultA default value for the variable if it is not found.
bool$filter_resultIf true, then the result is filtered for bad tags.
Returns
mixed
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 20 of file input.php.

set_input ( string  $variable,
  $value 
)

Sets an input value that may later be retrieved by get_input.

Note: this function does not handle nested arrays (ex: form input of param[m][n])

Parameters
string$variableThe name of the variable
mixed$valueThe value of the variable
Returns
void

Definition at line 34 of file input.php.