includes/api/class-wc-rest-products-controller.php 1 location
|
@@ 192-206 (lines=15) @@
|
189 |
|
* @param WC_Product|WC_Product_Variation $product |
190 |
|
* @return array |
191 |
|
*/ |
192 |
|
protected function get_downloads( $product ) { |
193 |
|
$downloads = array(); |
194 |
|
|
195 |
|
if ( $product->is_downloadable() ) { |
196 |
|
foreach ( $product->get_files() as $file_id => $file ) { |
197 |
|
$downloads[] = array( |
198 |
|
'id' => $file_id, // MD5 hash. |
199 |
|
'name' => $file['name'], |
200 |
|
'file' => $file['file'], |
201 |
|
); |
202 |
|
} |
203 |
|
} |
204 |
|
|
205 |
|
return $downloads; |
206 |
|
} |
207 |
|
|
208 |
|
/** |
209 |
|
* Get taxonomy terms. |
includes/cli/class-wc-cli-product.php 1 location
|
@@ 986-1003 (lines=18) @@
|
983 |
|
* @param WC_Product|WC_Product_Variation $product |
984 |
|
* @return array |
985 |
|
*/ |
986 |
|
private function get_downloads( $product ) { |
987 |
|
|
988 |
|
$downloads = array(); |
989 |
|
|
990 |
|
if ( $product->is_downloadable() ) { |
991 |
|
|
992 |
|
foreach ( $product->get_files() as $file_id => $file ) { |
993 |
|
|
994 |
|
$downloads[] = array( |
995 |
|
'id' => $file_id, // do not cast as int as this is a hash |
996 |
|
'name' => $file['name'], |
997 |
|
'file' => $file['file'], |
998 |
|
); |
999 |
|
} |
1000 |
|
} |
1001 |
|
|
1002 |
|
return $downloads; |
1003 |
|
} |
1004 |
|
|
1005 |
|
/** |
1006 |
|
* Get an individual variation's data |