You appear to be a bot. Output may be restricted
Description
Get the Export Data
Usage
$array = EDD_Batch_Downloads_Export::get_data();
Parameters
Returns
array $data The data for the CSV file
Source
File name: easy-digital-downloads/includes/admin/reporting/export/class-batch-export-downloads.php
Lines:
1 to 100 of 145
public function get_data() { $data = array(); $meta = array( 'edd_price', '_edd_files', '_edd_download_limit', '_thumbnail_id', 'edd_sku', 'edd_product_notes', '_edd_download_sales', '_edd_download_earnings' ); $args = array( 'post_type' => 'download', 'posts_per_page' => 30, 'paged' => $this->step, 'orderby' => 'ID', 'order' => 'ASC' ); $downloads = new WP_Query( $args ); if ( $downloads->posts ) { foreach ( $downloads->posts as $download ) { $row = array(); foreach( $this->csv_cols() as $key => $value ) { // Setup default value $row[ $key ] = ''; if( in_array( $key, $meta ) ) { switch( $key ) { case '_thumbnail_id' : $image_id = get_post_thumbnail_id( $download->ID ); $row[ $key ] = wp_get_attachment_url( $image_id ); break; case 'edd_price' : if( edd_has_variable_prices( $download->ID ) ) { $prices = array(); foreach( edd_get_variable_prices( $download->ID ) as $price ) { $prices[] = $price['name'] . ': ' . $price['amount']; } $row[ $key ] = implode( ' | ', $prices ); } else { $row[ $key ] = edd_get_download_price( $download->ID ); } break; case '_edd_files' : $files = array(); foreach( edd_get_download_files( $download->ID ) as $file ) { $f = $file['file']; if ( edd_has_variable_prices( $download->ID ) ) { $condition = isset( $file['condition'] ) ? $file['condition'] : 'all'; $f .= ';' . $condition; } $files[] = $f; unset( $file ); } $row[ $key ] = implode( ' | ', $files ); break; default : $row[ $key ] = get_post_meta( $download->ID, $key, true ); break; } } elseif( isset( $download->$key ) ) { switch( $key ) { case 'post_author' :