Tribe__Events__Community__Submission_Handler::sanitize_linked_post( string $key, array $submission )

Sanitizes the linked post data submitted from the community forms.


Parameters #

$key

(string) (Required) Which Linked post we are dealing with.

$submission

(array) (Required) Data submitted from community Events form.


Top ↑

Return #

(array) Returned data after cleanup.


Top ↑

Source #

File: src/Tribe/Submission_Handler.php

	public function sanitize_linked_post( $key, $submission ) {
		$lowercase_key = strtolower( $key );
		$uppercase_key = ucfirst( $lowercase_key );
		$is_empty_lowercase = empty( $submission[ $lowercase_key ] );
		$is_empty_uppercase = empty( $submission[ $uppercase_key ] );

		if ( $is_empty_lowercase && $is_empty_uppercase ) {
			return $submission;
		}

		if ( ! $is_empty_lowercase ) {
			if ( ! empty( $submission[ $lowercase_key ][ $lowercase_key ] ) ) {
				$submission[ $lowercase_key ][ $lowercase_key ] = $this->sanitize_data( $submission[ $lowercase_key ][ $lowercase_key ] );
			}

			if ( ! empty( $submission[ $lowercase_key ][ $uppercase_key ] ) ) {
				$submission[ $lowercase_key ][ $uppercase_key ] = $this->sanitize_data( $submission[ $lowercase_key ][ $uppercase_key ] );
			}
		}

		if ( ! $is_empty_uppercase ) {
			if ( ! empty( $submission[ $uppercase_key ][ $lowercase_key ] ) ) {
				$submission[ $uppercase_key ][ $lowercase_key ] = $this->sanitize_data( $submission[ $uppercase_key ][ $lowercase_key ] );
			}

			if ( ! empty( $submission[ $uppercase_key ][ $uppercase_key ] ) ) {
				$submission[ $uppercase_key ][ $uppercase_key ] = $this->sanitize_data( $submission[ $uppercase_key ][ $uppercase_key ] );
			}
		}

		return $submission;
	}

Top ↑

Changelog #

Changelog
Version Description
4.5.2.1 Introduced.