Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentsExtensionSuggestions::sanitize_extension_incentive
Sanitize the incentive details for a payment extension.
Метод класса: PaymentsExtensionSuggestions{}
Хуков нет.
Возвращает
array. The sanitized incentive details.
Использование
// private - только в коде основоного (родительского) класса $result = $this->sanitize_extension_incentive( $incentive ): array;
- $incentive(массив) (обязательный)
- The incentive details.
Код PaymentsExtensionSuggestions::sanitize_extension_incentive() PaymentsExtensionSuggestions::sanitize extension incentive WC 11.2.1
private function sanitize_extension_incentive( array $incentive ): array {
// Apply a very loose 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
);
}