REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.87 KB
Close
//home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Utilities/MetaDataUtil.php
Text
Base64
<?php declare( strict_types = 1 ); namespace Automattic\WooCommerce\Utilities; use WC_Data; /** * Utility methods for handling meta data in REST API requests. * * @since 10.8.0 */ class MetaDataUtil { /** * Normalize and process meta data entries from a REST API request. * * Skips entries without a key, applies defaults for missing 'value' and 'id' * fields, then calls update_meta_data on the given WC_Data object * for each valid entry. * * @since 10.8.0 * * @param mixed $meta_data Raw meta data from the request (non-array values are ignored). * @param WC_Data $target A WC_Data object to call update_meta_data on. * @param mixed $default_id Default value for 'id' when not provided (default ''). */ public static function update( $meta_data, WC_Data $target, $default_id = '' ): void { if ( ! is_array( $meta_data ) ) { return; } foreach ( self::normalize( $meta_data, $default_id ) as $meta ) { $target->update_meta_data( $meta['key'], $meta['value'], $meta['id'] ); } } /** * Normalize an array of raw meta data entries from a REST API request. * * Filters out entries without a key and applies default values for * missing 'value' and 'id' fields. Each returned entry is guaranteed * to have 'key', 'value', and 'id' set. * * @since 10.8.0 * * @param array $meta_data Raw meta data array from the request. * @param mixed $default_id Default value for 'id' when not provided (default ''). * @return array[] Normalized meta data entries. */ public static function normalize( array $meta_data, $default_id = '' ): array { $normalized = array(); foreach ( $meta_data as $meta ) { if ( is_array( $meta ) && isset( $meta['key'] ) ) { $normalized[] = array( 'key' => $meta['key'], 'value' => $meta['value'] ?? null, 'id' => $meta['id'] ?? $default_id, ); } } return $normalized; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 14
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ArrayUtil.php
12.99 KB
lrw-r--r--
2025-05-12 21:07:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CallbackUtil.php
4.40 KB
lrw-r--r--
2026-01-19 14:46:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DiscountsUtil.php
1.10 KB
lrw-r--r--
2024-05-30 18:23:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FeaturesUtil.php
5.19 KB
lrw-r--r--
2026-01-26 10:40:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
I18nUtil.php
1.69 KB
lrw-r--r--
2023-02-22 07:17:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LoggingUtil.php
3.18 KB
lrw-r--r--
2024-08-27 23:04:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MetaDataUtil.php
1.87 KB
lrw-r--r--
2026-05-05 14:26:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
NumberUtil.php
7.11 KB
lrw-r--r--
2025-07-29 12:34:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
OrderUtil.php
9.19 KB
lrw-r--r--
2025-11-24 23:10:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PluginUtil.php
12.99 KB
lrw-r--r--
2025-10-06 17:56:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RestApiUtil.php
5.01 KB
lrw-r--r--
2025-11-24 23:10:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ShippingUtil.php
1020 B
lrw-r--r--
2025-05-12 21:07:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
StringUtil.php
5.09 KB
lrw-r--r--
2024-06-04 15:20:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TimeUtil.php
1.16 KB
lrw-r--r--
2024-01-30 23:24:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).