AgenticCheckoutUtils.php
4 months ago
ArrayUtils.php
2 years ago
CartController.php
1 month ago
CartTokenUtils.php
1 year ago
CheckoutTrait.php
1 month ago
DraftOrderTrait.php
1 year ago
JsonWebToken.php
11 months ago
LocalPickupUtils.php
5 months ago
NoticeHandler.php
1 year ago
OrderAuthorizationTrait.php
6 months ago
OrderController.php
1 month ago
Pagination.php
2 years ago
PaymentUtils.php
1 year ago
ProductItemTrait.php
1 month ago
ProductLinksTrait.php
3 months ago
ProductQuery.php
2 months ago
ProductQueryFilters.php
11 months ago
QuantityLimits.php
11 months ago
RateLimits.php
1 year ago
SanitizationUtils.php
2 years ago
ValidationUtils.php
2 years ago
SanitizationUtils.php
32 lines
| 1 | <?php |
| 2 | namespace Automattic\WooCommerce\StoreApi\Utilities; |
| 3 | |
| 4 | /** |
| 5 | * SanitizationUtils class. |
| 6 | * Helper class which sanitizes customer info. |
| 7 | */ |
| 8 | class SanitizationUtils { |
| 9 | |
| 10 | /** |
| 11 | * Runs wp_kses on an array. This function runs wp_kses on strings in the array and recurses into arrays. |
| 12 | * |
| 13 | * @param array $array The array to run wp_kses on. |
| 14 | * @return mixed The array, all string keys will have been run through wp_kses. |
| 15 | */ |
| 16 | public function wp_kses_array( array $array ) { |
| 17 | foreach ( $array as $key => $value ) { |
| 18 | if ( empty( $value ) ) { |
| 19 | $array[ $key ] = $value; |
| 20 | continue; |
| 21 | } |
| 22 | if ( is_array( $value ) ) { |
| 23 | $array[ $key ] = $this->wp_kses_array( $value ); |
| 24 | } |
| 25 | if ( is_string( $value ) ) { |
| 26 | $array[ $key ] = wp_kses( $value, [] ); |
| 27 | } |
| 28 | } |
| 29 | return $array; |
| 30 | } |
| 31 | } |
| 32 |