WC_Meta_Box_Product_Data::prepare_downloads()private staticWC 1.0

Prepare downloads for save.

{} It's a method of the class: WC_Meta_Box_Product_Data{}

No Hooks.

Return

Array.

Usage

$result = WC_Meta_Box_Product_Data::prepare_downloads( $file_names, $file_urls, $file_hashes );
$file_names(array) (required)
File names.
$file_urls(array) (required)
File urls.
$file_hashes(array) (required)
File hashes.

Code of WC_Meta_Box_Product_Data::prepare_downloads() WC 6.7.0

private static function prepare_downloads( $file_names, $file_urls, $file_hashes ) {
	$downloads = array();

	if ( ! empty( $file_urls ) ) {
		$file_url_size = count( $file_urls );

		for ( $i = 0; $i < $file_url_size; $i ++ ) {
			if ( ! empty( $file_urls[ $i ] ) ) {
				$downloads[] = array(
					'name'        => wc_clean( $file_names[ $i ] ),
					'file'        => wp_unslash( trim( $file_urls[ $i ] ) ),
					'download_id' => wc_clean( $file_hashes[ $i ] ),
				);
			}
		}
	}
	return $downloads;
}