
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: MetaDataUtil.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?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 &#039;value&#039; and &#039;id&#039;
	 * 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 &#039;id&#039; when not provided (default &#039;&#039;).
	 */
	public static function update( $meta_data, WC_Data $target, $default_id = &#039;&#039; ): void {
		if ( ! is_array( $meta_data ) ) {
			return;
		}

		foreach ( self::normalize( $meta_data, $default_id ) as $meta ) {
			$target-&gt;update_meta_data( $meta[&#039;key&#039;], $meta[&#039;value&#039;], $meta[&#039;id&#039;] );
		}
	}

	/**
	 * 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 &#039;value&#039; and &#039;id&#039; fields. Each returned entry is guaranteed
	 * to have &#039;key&#039;, &#039;value&#039;, and &#039;id&#039; set.
	 *
	 * @since 10.8.0
	 *
	 * @param array $meta_data Raw meta data array from the request.
	 * @param mixed $default_id Default value for &#039;id&#039; when not provided (default &#039;&#039;).
	 * @return array[] Normalized meta data entries.
	 */
	public static function normalize( array $meta_data, $default_id = &#039;&#039; ): array {
		$normalized = array();
		foreach ( $meta_data as $meta ) {
			if ( is_array( $meta ) &amp;&amp; isset( $meta[&#039;key&#039;] ) ) {
				$normalized[] = array(
					&#039;key&#039;   =&gt; $meta[&#039;key&#039;],
					&#039;value&#039; =&gt; $meta[&#039;value&#039;] ?? null,
					&#039;id&#039;    =&gt; $meta[&#039;id&#039;] ?? $default_id,
				);
			}
		}
		return $normalized;
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://tiffingrab.ca/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://tiffingrab.ca/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-taxonomies-product_tag-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
