当前位置: 首页>>代码示例>>PHP>>正文


PHP edd_get_download_sales_stats函数代码示例

本文整理汇总了PHP中edd_get_download_sales_stats函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_download_sales_stats函数的具体用法?PHP edd_get_download_sales_stats怎么用?PHP edd_get_download_sales_stats使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了edd_get_download_sales_stats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edd_render_download_columns

/**
 * Render Download Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        global $edd_options;
        $style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
        $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
        $purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                if (edd_has_variable_prices($post_id)) {
                    echo edd_price_range($post_id);
                } else {
                    echo edd_price($post_id, false);
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                echo edd_get_download_sales_stats($post_id);
                break;
            case 'earnings':
                echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
                break;
            case 'shortcode':
                echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
                break;
        }
    }
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:42,代码来源:dashboard-columns.php

示例2: edd_render_download_columns

/**
 * Render Donwload Columns
 *
 * Render the custom columns content.
 *
 * @access      private
 * @since       1.0 
 * @return      void
*/
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        $sales = edd_get_download_sales_stats($post_id);
        $earnings = edd_get_download_earnings_stats($post_id);
        $color = get_post_meta($post_id, '_edd_purchase_color', true);
        $color = $color ? $color : 'blue';
        $purchase_text = get_post_meta($post_id, '_edd_purchase_text', true);
        $purchase_text = $purchase_text && '' !== $purchase_text ? $purchase_text : __('Purchase', 'edd');
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                echo edd_price($post_id, false);
                if (!edd_has_variable_prices($post_id)) {
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                echo $sales;
                break;
            case 'earnings':
                echo edd_currency_filter($earnings);
                break;
            case 'shortcode':
                echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="button" color="' . esc_attr($color) . '"]';
                break;
        }
    }
}
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:43,代码来源:dashboard-columns.php

示例3: edd_show_download_sales_graph

/**
 * Show Download Sales Graph
 *
 * @access      public
 * @since       1.0 
 * @return      void
*/
function edd_show_download_sales_graph($bgcolor = 'white')
{
    $downloads = get_posts(array('post_type' => 'download', 'posts_per_page' => -1));
    if ($downloads) {
        ob_start();
        ?>
	    <script type="text/javascript">
		    google.load("visualization", "1", {packages:["corechart"]});
			// sales chart
		    google.setOnLoadCallback(drawSalesChart);
		    function drawSalesChart() {
		        var data = new google.visualization.DataTable();
		        data.addColumn('string', '<?php 
        echo edd_get_label_plural();
        ?>
');
		        data.addColumn('number', '<?php 
        _e("Sales", "edd");
        ?>
');
		        data.addRows([
					<?php 
        foreach ($downloads as $download) {
            ?>
		          		['<?php 
            echo html_entity_decode(get_the_title($download->ID), ENT_COMPAT, 'UTF-8');
            ?>
', 
							<?php 
            echo edd_get_download_sales_stats($download->ID);
            ?>
, 
						],
					<?php 
        }
        ?>
		        ]);

		        var options = {
		          	title: "<?php 
        echo sprintf(__('%s Performance in Sales', 'edd'), edd_get_label_singular());
        ?>
",
					colors:['#a3bcd3'],
					fontSize: 12,
					backgroundColor: '<?php 
        echo $bgcolor;
        ?>
'
		        };

		        var chart = new google.visualization.ColumnChart(document.getElementById('sales_chart_div'));
		        chart.draw(data, options);
		    }
	    </script>
		<div id="sales_chart_div"></div>
		<?php 
        echo ob_get_clean();
    }
}
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:67,代码来源:graphing.php

示例4: eddlc_display_filtered_download

/**
 * Displays selected download above table and message if no download is selected
 * 
 * @param $id
 *
 * @return string
 */
function eddlc_display_filtered_download($id)
{
    if (edd_get_download_sales_stats($id)) {
        $sales = edd_get_download_sales_stats($id);
        $title = get_the_title($id);
        $message = '<strong>Selected download: </strong>' . $title . '<br/><strong>Sales: </strong>' . $sales;
    } elseif ($id) {
        $message = 'No valid download selected.';
    } else {
        $message = 'No download selected.';
    }
    $output = '<div class="postbox"><div class="inside">' . $message . '</div></div>';
    return $output;
}
开发者ID:brashrebel,项目名称:edd-likelihood-calculator,代码行数:21,代码来源:functions.php

示例5: edd_render_download_columns

/**
 * Render Download Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        global $edd_options;
        $style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
        $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
        $color = $color == 'inherit' ? '' : $color;
        $purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                if (edd_has_variable_prices($post_id)) {
                    echo edd_price_range($post_id);
                } else {
                    echo edd_price($post_id, false);
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&tab=logs&view=sales&download=' . $post_id)) . '">';
                    echo edd_get_download_sales_stats($post_id);
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
            case 'earnings':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $post_id)) . '">';
                    echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
            case 'shortcode':
                echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
                break;
        }
    }
}
开发者ID:Bragi26,项目名称:Easy-Digital-Downloads,代码行数:55,代码来源:dashboard-columns.php

示例6: edd_purchase_limit_remaining_shortcode

/**
 * Purchases Remaining
 *
 * @since       1.0.1
 * @param       array $atts Arguments to pass to the shortcode
 * @global      object $post The object related to this post
 * @return      void
 */
function edd_purchase_limit_remaining_shortcode($atts)
{
    global $post;
    $scope = edd_get_option('edd_purchase_limit_scope') ? edd_get_option('edd_purchase_limit_scope') : 'site-wide';
    $sold_out_label = edd_get_option('edd_purchase_limit_sold_out_label') ? edd_get_option('edd_purchase_limit_sold_out_label') : __('Sold Out', 'edd-purchase-limit');
    $defaults = array('download_id' => $post->ID);
    $atts = wp_parse_args($atts, $defaults);
    $max_purchases = edd_pl_get_file_purchase_limit($atts['download_id']);
    if ($scope == 'site-wide' && $max_purchases) {
        $purchases = edd_get_download_sales_stats($atts['download_id']);
    } elseif ($scope == 'per-user' && $max_purchases) {
        $purchases = edd_pl_get_user_purchase_count(get_current_user_id(), $atts['download_id']);
    }
    if ($purchases < $max_purchases) {
        $purchases_left = $max_purchases - $purchases;
        return '<span class="edd_purchases_left">' . $purchases_left . '</span>';
    } else {
        return '<span class="edd_purchases_left edd_sold_out">' . $sold_out_label . '</span>';
    }
}
开发者ID:brashrebel,项目名称:EDD-Purchase-Limit,代码行数:28,代码来源:shortcodes.php

示例7: edd_render_download_columns

/**
 * Render Download Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                if (edd_has_variable_prices($post_id)) {
                    echo edd_price_range($post_id);
                } else {
                    echo edd_price($post_id, false);
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&tab=logs&view=sales&download=' . $post_id)) . '">';
                    echo edd_get_download_sales_stats($post_id);
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
            case 'earnings':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $post_id)) . '">';
                    echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
        }
    }
}
开发者ID:pderksen,项目名称:Easy-Digital-Downloads,代码行数:47,代码来源:dashboard-columns.php

示例8: edd_dashboard_sales_widget


//.........这里部分代码省略.........
		<table>
			<tbody>
				<tr class="first">
					<td class="b b-earnings"><?php 
    echo edd_currency_filter(edd_format_amount(edd_get_total_earnings()));
    ?>
</td>
					<td class="last t earnings"><?php 
    _e('Total Earnings', 'edd');
    ?>
</td>
				</tr>
				<tr>
					<td class="b b-sales"><?php 
    echo edd_get_total_sales();
    ?>
</td>
					<td class="last t sales"><?php 
    _e('Total Sales', 'edd');
    ?>
</td>
				</tr>
			</tbody>
		</table>
		<?php 
    if ($top_selling) {
        foreach ($top_selling as $list) {
            ?>
				<p class="lifetime_best_selling label_heading"><?php 
            _e('Lifetime Best Selling', 'edd');
            ?>
</p>
				<p><span class="lifetime_best_selling_label"><?php 
            echo edd_get_download_sales_stats($list->ID);
            ?>
</span> <a href="<?php 
            echo get_permalink($list->ID);
            ?>
"><?php 
            echo get_the_title($list->ID);
            ?>
</a></p>
		<?php 
        }
    }
    ?>
	</div>
	<div style="clear: both"></div>
	<?php 
    $payments = edd_get_payments(array('number' => 5, 'mode' => 'live', 'orderby' => 'post_date', 'order' => 'DESC', 'user' => null, 'status' => 'publish', 'meta_key' => null));
    if ($payments) {
        ?>
	<p class="edd_dashboard_widget_subheading"><?php 
        _e('Recent Purchases', 'edd');
        ?>
</p>
	<div class="table recent_purchases">
		<table>
			<tbody>
				<?php 
        foreach ($payments as $payment) {
            $payment_meta = edd_get_payment_meta($payment->ID);
            ?>
				<tr>
					<td><?php 
            echo get_the_title($payment->ID);
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:67,代码来源:dashboard-widgets.php

示例9: edd_dashboard_sales_widget


//.........这里部分代码省略.........
			<table>
				<tbody>
					<tr class="first">
						<td class="b b-earnings"><?php 
    echo edd_currency_filter(edd_format_amount(edd_get_total_earnings()));
    ?>
</td>
						<td class="last t earnings"><?php 
    _e('Total Earnings', 'edd');
    ?>
</td>
					</tr>
					<tr>
						<td class="b b-sales"><?php 
    echo edd_get_total_sales();
    ?>
</td>
						<td class="last t sales"><?php 
    _e('Total Sales', 'edd');
    ?>
</td>
					</tr>
				</tbody>
			</table>
			<?php 
    if ($top_selling) {
        foreach ($top_selling as $list) {
            ?>
					<p class="lifetime_best_selling label_heading"><?php 
            _e('Lifetime Best Selling', 'edd');
            ?>
</p>
					<p><span class="lifetime_best_selling_label"><?php 
            echo edd_get_download_sales_stats($list->ID);
            ?>
</span> <a href="<?php 
            echo get_permalink($list->ID);
            ?>
"><?php 
            echo get_the_title($list->ID);
            ?>
</a></p>
			<?php 
        }
    }
    ?>
		</div>
		<div style="clear: both"></div>
		<?php 
    $payments = edd_get_payments(array('number' => 5, 'mode' => 'live', 'orderby' => 'post_date', 'order' => 'DESC', 'user' => null, 'status' => 'publish', 'meta_key' => null, 'fields' => 'ids'));
    if ($payments) {
        ?>
		<p class="edd_dashboard_widget_subheading"><?php 
        _e('Recent Purchases', 'edd');
        ?>
</p>
		<div class="table recent_purchases">
			<table>
				<tbody>
					<?php 
        foreach ($payments as $payment) {
            $payment_meta = edd_get_payment_meta($payment);
            ?>
					<tr>
						<td>
							<?php 
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:67,代码来源:dashboard-widgets.php

示例10: decrease_sales

 /**
  * Decrement the sale count by one
  *
  * @since 2.2
  * @param int $quantity The quantity to decrease by
  * @return int|false
  */
 public function decrease_sales($quantity = 1)
 {
     $sales = edd_get_download_sales_stats($this->ID);
     // Only decrease if not already zero
     if ($sales > 0) {
         $quantity = absint($quantity);
         $total_sales = $sales - $quantity;
         if ($this->update_meta('_edd_download_sales', $total_sales)) {
             $this->sales = $total_sales;
             return $this->sales;
         }
     }
     return false;
 }
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:21,代码来源:class-edd-download.php

示例11: eddc_user_product_list

/**
 * Given a User ID, return the markup for the list of user's products that earn commissions
 *
 * @param  integer $user_id The User ID to get the commissioned products for
 * @return string           HTML markup for the list of products
 */
function eddc_user_product_list($user_id = 0)
{
    $user_id = empty($user_id) ? get_current_user_id() : $user_id;
    if (empty($user_id)) {
        return;
    }
    $products = eddc_get_download_ids_of_user($user_id);
    if (empty($products)) {
        return;
    }
    $header_text = __('Your Products', 'eddc');
    if ($user_id != get_current_user_id()) {
        $user_info = get_userdata($user_id);
        $header_text = sprintf(__('%s\'s Products', 'eddc'), $user_info->display_name);
    }
    ob_start();
    ?>
	<div id="edd_commissioned_products">
		<h3 class="edd_commissioned_products_header"><?php 
    echo $header_text;
    ?>
</h3>
		<table id="edd_commissioned_products_table">
			<thead>
				<tr>
					<?php 
    do_action('edd_commissioned_products_head_row_begin');
    ?>
					<th class="edd_commissioned_item"><?php 
    _e('Item', 'eddc');
    ?>
</th>
					<th class="edd_commissioned_sales"><?php 
    _e('Sales', 'eddc');
    ?>
</th>
					<?php 
    do_action('edd_commissioned_products_head_row_end');
    ?>
				</tr>
			</thead>
			<tbody>
			<?php 
    if (!empty($products)) {
        ?>
				<?php 
        foreach ($products as $product) {
            if (!get_post($product)) {
                continue;
            }
            ?>
					<tr class="edd_user_commission_row">
						<?php 
            do_action('edd_commissioned_products_row_begin', $product, $user_id);
            ?>
						<td class="edd_commissioned_item"><?php 
            echo get_the_title($product);
            ?>
</td>
						<td class="edd_commissioned_sales"><?php 
            echo edd_get_download_sales_stats($product);
            ?>
</td>
						<?php 
            do_action('edd_commissioned_products_row_end', $product, $user_id);
            ?>
					</tr>
				<?php 
        }
        ?>
			<?php 
    } else {
        ?>
				<tr class="edd_commissioned_products_row_empty">
					<td colspan="4"><?php 
        _e('No item', 'eddc');
        ?>
</td>
				</tr>
			<?php 
    }
    ?>
			</tbody>
		</table>
	</div>
	<?php 
    return ob_get_clean();
}
开发者ID:chriscct7,项目名称:EDD-Commissions-1,代码行数:94,代码来源:short-codes.php

示例12: reports_data

 /**
  * Build all the reports data
  *
  * @access public
  * @since 1.5
  * @return array $reports_data All the data for customer reports
  */
 public function reports_data()
 {
     $reports_data = array();
     $downloads = $this->products->posts;
     if ($downloads) {
         foreach ($downloads as $download) {
             $reports_data[] = array('ID' => $download, 'title' => get_the_title($download), 'sales' => edd_get_download_sales_stats($download), 'earnings' => edd_get_download_earnings_stats($download), 'average_sales' => edd_get_average_monthly_download_sales($download), 'average_earnings' => edd_get_average_monthly_download_earnings($download));
         }
     }
     return $reports_data;
 }
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:18,代码来源:class-download-reports-table.php

示例13: product_list_sales_esc

 public function product_list_sales_esc($product_id)
 {
     $sales = esc_html(edd_get_download_sales_stats($product_id));
     $sales = apply_filters('fes_product_list_title', $sales, $product_id);
     return $sales;
 }
开发者ID:SelaInc,项目名称:eassignment,代码行数:6,代码来源:class-dashboard.php

示例14: get_all_products

 public function get_all_products($user_id = false, $status = array('draft', 'pending', 'publish', 'trash', 'future', 'private'))
 {
     global $wpdb;
     global $current_user;
     if (!$user_id) {
         $user_id = $current_user->ID;
     }
     $vendor_products = array();
     $vendor_products = get_posts(array('nopaging' => true, 'author' => $user_id, 'orderby' => 'title', 'post_type' => 'download', 'post_status' => $status, 'order' => 'ASC'));
     if (empty($vendor_products)) {
         return false;
     }
     foreach ($vendor_products as $product) {
         $data[] = array('ID' => $product->ID, 'title' => $product->post_title, 'status' => $product->post_status, 'url' => esc_url(admin_url('post.php?post=' . $product->ID . '&action=edit')), 'sales' => edd_get_download_sales_stats($product->ID));
     }
     $data = $this->array_msort($data, array('status' => SORT_ASC, 'title' => SORT_ASC, 'sales' => SORT_DESC, 'ID' => SORT_ASC, 'url' => SORT_ASC));
     $data = apply_filters('fes_get_all_products', $data, $user_id);
     return $data;
 }
开发者ID:SelaInc,项目名称:eassignment,代码行数:19,代码来源:class-vendors.php

示例15: edd_generate_pdf

/**
 * Generate PDF Reports
 *
 * Generates PDF report on sales and earnings for all downloads for the current year.
 *
 * @since 1.1.4.0
 * @param string $data
 * @uses edd_pdf
 * @author Sunny Ratilal
 */
function edd_generate_pdf($data)
{
    $edd_pdf_reports_nonce = $_GET['_wpnonce'];
    if (wp_verify_nonce($edd_pdf_reports_nonce, 'edd_generate_pdf')) {
        require_once EDD_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
        require_once EDD_PLUGIN_DIR . '/includes/libraries/fpdf/edd_pdf.php';
        $daterange = date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))) . ' ' . utf8_decode(__('to', 'edd')) . ' ' . date_i18n(get_option('date_format'));
        $pdf = new edd_pdf();
        $pdf->AddPage('L', 'A4');
        $pdf->SetTitle(utf8_decode(__('Sales and earnings reports for the current year for all products', 'edd')));
        $pdf->SetAuthor(utf8_decode(__('Easy Digital Downloads', 'edd')));
        $pdf->SetCreator(utf8_decode(__('Easy Digital Downloads', 'edd')));
        $pdf->Image(EDD_PLUGIN_URL . 'assets/images/edd-logo.png', 205, 10);
        $pdf->SetMargins(8, 8, 8);
        $pdf->SetX(8);
        $pdf->SetFont('Helvetica', '', 16);
        $pdf->SetTextColor(50, 50, 50);
        $pdf->Cell(0, 3, utf8_decode(__('Sales and earnings reports for the current year for all products', 'edd')), 0, 2, 'L', false);
        $pdf->SetFont('Helvetica', '', 13);
        $pdf->Ln();
        $pdf->SetTextColor(150, 150, 150);
        $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'edd')) . $daterange, 0, 2, 'L', false);
        $pdf->Ln();
        $pdf->SetTextColor(50, 50, 50);
        $pdf->SetFont('Helvetica', '', 14);
        $pdf->Cell(0, 10, utf8_decode(__('Table View', 'edd')), 0, 2, 'L', false);
        $pdf->SetFont('Helvetica', '', 12);
        $pdf->SetFillColor(238, 238, 238);
        $pdf->Cell(70, 6, utf8_decode(__('Product Name', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(30, 6, utf8_decode(__('Price', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(50, 6, utf8_decode(__('Categories', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(50, 6, utf8_decode(__('Tags', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(45, 6, utf8_decode(__('Number of Sales', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(35, 6, utf8_decode(__('Earnings to Date', 'edd')), 1, 1, 'L', true);
        $year = date('Y');
        $downloads = get_posts(array('post_type' => 'download', 'year' => $year, 'posts_per_page' => -1));
        if ($downloads) {
            $pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
            foreach ($downloads as $download) {
                $pdf->SetFillColor(255, 255, 255);
                $title = utf8_decode(get_the_title($download->ID));
                if (edd_has_variable_prices($download->ID)) {
                    $prices = edd_get_variable_prices($download->ID);
                    $first = $prices[0]['amount'];
                    $last = array_pop($prices);
                    $last = $last['amount'];
                    if ($first < $last) {
                        $min = $first;
                        $max = $last;
                    } else {
                        $min = $last;
                        $max = $first;
                    }
                    $price = html_entity_decode(edd_currency_filter(edd_format_amount($min)) . ' - ' . edd_currency_filter(edd_format_amount($max)));
                } else {
                    $price = html_entity_decode(edd_currency_filter(edd_get_download_price($download->ID)));
                }
                $categories = get_the_term_list($download->ID, 'download_category', '', ', ', '');
                $categories = $categories ? strip_tags($categories) : '';
                $tags = get_the_term_list($download->ID, 'download_tag', '', ', ', '');
                $tags = $tags ? strip_tags($tags) : '';
                $sales = edd_get_download_sales_stats($download->ID);
                $link = get_permalink($download->ID);
                $earnings = html_entity_decode(edd_currency_filter(edd_get_download_earnings_stats($download->ID)));
                $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
            }
        } else {
            $pdf->SetWidths(array(280));
            $title = utf8_decode(sprintf(__('No %s found.', 'edd'), edd_get_label_plural()));
            $pdf->Row(array($title));
        }
        $pdf->Ln();
        $pdf->SetTextColor(50, 50, 50);
        $pdf->SetFont('Helvetica', '', 14);
        $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'edd')), 0, 2, 'L', false);
        $pdf->SetFont('Helvetica', '', 12);
        $image = html_entity_decode(urldecode(edd_draw_chart_image()));
        $image = str_replace(' ', '%20', $image);
        $pdf->SetX(25);
        $pdf->Image($image . '&file=.png');
        $pdf->Ln(7);
        $pdf->Output('edd-report-' . date_i18n('Y-m-d') . '.pdf', 'D');
    }
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:94,代码来源:pdf-reports.php


注:本文中的edd_get_download_sales_stats函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。