acf_sanitize_files_value_array()ACF 6.0.5

Sanitizes file upload values within the array.

This addresses nested file fields within repeaters and groups.

Хуков нет.

Возвращает

Массив.

Использование

acf_sanitize_files_value_array( $array, $sanitize_);
$array(массив) (обязательный)
The file upload array.
$sanitize_function(строка) (обязательный)
Callback used to sanitize array value.

Список изменений

С версии 6.0.5 Введена.

Код acf_sanitize_files_value_array() ACF 6.4.2

function acf_sanitize_files_value_array( $array, $sanitize_function ) {
	if ( ! function_exists( $sanitize_function ) ) {
		return $array;
	}

	if ( ! is_array( $array ) ) {
		return $sanitize_function( $array );
	}

	foreach ( $array as $key => $value ) {
		if ( is_array( $value ) ) {
			$array[ $key ] = acf_sanitize_files_value_array( $value, $sanitize_function );
		} else {
			$array[ $key ] = $sanitize_function( $value );
		}
	}

	return $array;
}