Automattic\WooCommerce\Internal\Admin\Suggestions

PaymentExtensionSuggestions::sanitize_extension_incentive()privateWC 1.0

Sanitize the incentive details for a payment extension.

Метод класса: PaymentExtensionSuggestions{}

Хуков нет.

Возвращает

Массив. The sanitized incentive details.

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

// private - только в коде основоного (родительского) класса
$result = $this->sanitize_extension_incentive( $incentive ): array;
$incentive(массив) (обязательный)
The incentive details.

Код PaymentExtensionSuggestions::sanitize_extension_incentive() WC 9.6.1

private function sanitize_extension_incentive( array $incentive ): array {
	// Apply a very lose sanitization. Stricter sanitization can be applied downstream, if needed.
	return array_map(
		function ( $value ) {
			// Make sure that if we have HTML tags, we only allow a limited set of tags (only stylistic ones).
			if ( is_string( $value ) && preg_match( '/<[^>]+>/', $value ) ) {
					$value = wp_kses( $value, wp_kses_allowed_html( 'data' ) );
			}

			return $value;
		},
		$incentive
	);
}