LLMS_Events::sanitize_raw_event( array $raw )
Recursively sanitize event data.
Parameters Parameters
- $raw
-
(array) (Required) Event information array.
Return Return
(array)
Source Source
File: includes/class-llms-events.php
protected function sanitize_raw_event( $raw ) {
$clean = array();
foreach ( $raw as $key => $val ) {
// This will recursively handle any metadata submitted.
if ( is_array( $val ) ) {
$val = $this->sanitize_raw_event( $val );
} elseif ( in_array( $key, array( 'actor_id', 'object_id' ), true ) ) {
// cast id fields to int.
$val = absint( $val );
} else {
// everything else is a text field.
$val = sanitize_text_field( $val );
}
// Sanitize the key. This will ensure no dirty keys are submitted in metadata.
$key = is_numeric( $key ) ? $key : sanitize_text_field( $key );
$clean[ $key ] = $val;
}
return $clean;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.36.0 | Introduced. |