/** * 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(); } }
/** * Get things started * * @access private * @since 1.4 * @return void */ function __construct() { global $status, $page; //Set parent defaults parent::__construct(array('singular' => edd_get_label_singular(), 'plural' => edd_get_label_plural(), 'ajax' => false)); $this->get_payment_counts(); }
/** * Add Download Filters * * Adds cross-sell/upsell drop down filters for downloads. * * @since 1.0 * @return void */ function edd_csau_download_filters() { global $typenow; // Checks if the current post type is 'download' if ($typenow == 'download') { $types = array('cross_sells' => sprintf(__('%s with cross-sells', 'edd-csau'), edd_get_label_plural()), 'upsells' => sprintf(__('%s with upsells', 'edd-csau'), edd_get_label_plural()), 'both' => sprintf(__('%s with cross-sells or upsells', 'edd-csau'), edd_get_label_plural())); echo "<select name='edd_csau' id='edd_csau' class='postform'>"; echo "<option value=''>" . sprintf(__('Show all %s', 'edd-csau'), strtolower(edd_get_label_plural())) . "</option>"; foreach ($types as $key => $label) { $args = array('post_type' => 'download', 'post_status' => 'publish'); if ('upsells' == $key) { $args['meta_key'] = '_edd_csau_upsell_products'; } elseif ('cross_sells' == $key) { $args['meta_key'] = '_edd_csau_cross_sell_products'; } elseif ('both' == $key) { $args['meta_query'] = array('relation' => 'OR', array('key' => '_edd_csau_cross_sell_products'), array('key' => '_edd_csau_upsell_products')); } else { $meta_key = ''; } $type = get_posts($args); $count = count($type); $selected = isset($_GET['edd_csau']) && $_GET['edd_csau'] == $key ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($label) . ' (' . $count . ')</option>'; } echo "</select>"; } }
/** * Setup Download Post Type * * Registers the Downloads CPT. * * @access private * @since 1.0 * @return void */ function edd_setup_edd_post_types() { $archives = true; if (defined('EDD_DISABLE_ARCHIVE') && EDD_DISABLE_ARCHIVE == true) { $archives = false; } $slug = 'downloads'; if (defined('EDD_SLUG')) { $slug = EDD_SLUG; } $rewrite = array('slug' => $slug, 'with_front' => false); if (defined('EDD_DISABLE_REWRITE') && EDD_DISABLE_REWRITE == true) { $rewrite = false; } $download_labels = apply_filters('edd_download_labels', array('name' => '%2$s', 'singular_name' => '%1$s', 'add_new' => __('Add New', 'edd'), 'add_new_item' => __('Add New %1$s', 'edd'), 'edit_item' => __('Edit %1$s', 'edd'), 'new_item' => __('New %1$s', 'edd'), 'all_items' => __('All %2$s', 'edd'), 'view_item' => __('View %1$s', 'edd'), 'search_items' => __('Search %2$s', 'edd'), 'not_found' => __('No %2$s found', 'edd'), 'not_found_in_trash' => __('No %2$s found in Trash', 'edd'), 'parent_item_colon' => '', 'menu_name' => __('%2$s', 'edd'))); foreach ($download_labels as $key => $value) { $download_labels[$key] = sprintf($value, edd_get_label_singular(), edd_get_label_plural()); } $download_args = array('labels' => $download_labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => $rewrite, 'capability_type' => 'post', 'has_archive' => $archives, 'hierarchical' => false, 'supports' => apply_filters('edd_download_supports', array('title', 'editor', 'thumbnail'))); register_post_type('download', apply_filters('edd_download_post_type_args', $download_args)); /* payment post type */ $payment_labels = array('name' => _x('Payments', 'post type general name', 'edd'), 'singular_name' => _x('Payment', 'post type singular name', 'edd'), 'add_new' => __('Add New', 'edd'), 'add_new_item' => __('Add New Payment', 'edd'), 'edit_item' => __('Edit Payment', 'edd'), 'new_item' => __('New Payment', 'edd'), 'all_items' => __('All Payments', 'edd'), 'view_item' => __('View Payment', 'edd'), 'search_items' => __('Search Payments', 'edd'), 'not_found' => __('No Payments found', 'edd'), 'not_found_in_trash' => __('No Payments found in Trash', 'edd'), 'parent_item_colon' => '', 'menu_name' => __('Payment History', 'edd')); $payment_args = array('labels' => apply_filters('edd_payment_labels', $payment_labels), 'public' => false, 'query_var' => false, 'rewrite' => false, 'capability_type' => 'post', 'supports' => array('title'), 'can_export' => true); register_post_type('edd_payment', $payment_args); /* discounts post type */ $discount_args = array('public' => false, 'query_var' => false, 'rewrite' => false, 'show_ui' => false, 'capability_type' => 'post', 'supports' => array('title'), 'can_export' => true); register_post_type('edd_discount', $discount_args); }
/** * Get things started * * @since 1.4 * @see WP_List_Table::__construct() */ public function __construct() { global $status, $page; // Set parent defaults parent::__construct(array('singular' => edd_get_label_singular(), 'plural' => edd_get_label_plural(), 'ajax' => false)); add_action('edd_log_view_actions', array($this, 'downloads_filter')); }
* * @var string * @since 1.4 */ public $active_count; /** * Inactive number of discounts *
/** * Add Download Meta Box * * @access private * @since 1.0 * @return void */ function edd_add_download_meta_box() { add_meta_box('downloadinformation', sprintf(__('%1$s Configuration', 'edd'), edd_get_label_singular(), edd_get_label_plural()), 'edd_render_download_meta_box', 'download', 'normal', 'default'); add_meta_box('edd_download_stats', sprintf(__('%1$s Stats', 'edd'), edd_get_label_singular(), edd_get_label_plural()), 'edd_render_stats_meta_box', 'download', 'side', 'high'); add_meta_box('edd_purchase_log', __('Purchase Log', 'edd'), 'edd_render_purchase_log_meta_box', 'download', 'normal', 'default'); add_meta_box('edd_file_download_log', __('File Download Log', 'edd'), 'edd_render_download_log_meta_box', 'download', 'normal', 'default'); }
/** * Get things started * * @since 1.5 * @see WP_List_Table::__construct() */ public function __construct() { global $status, $page; // Set parent defaults parent::__construct(array('singular' => edd_get_label_singular(), 'plural' => edd_get_label_plural(), 'ajax' => false)); add_action('edd_report_view_actions', array($this, 'category_filter')); $this->query(); }
/** * Constructor */ public function __construct() { $this->widget_cssclass = 'marketify_widget_featured_popular'; $this->widget_description = sprintf(__('Display featured and popular %s in sliding grid.', 'marketify'), edd_get_label_plural()); $this->widget_id = 'marketify_widget_featured_popular'; $this->widget_name = sprintf(__('Marketify - Home: Featured & Popular %s', 'marketify'), edd_get_label_plural()); $this->settings = array('featured-title' => array('type' => 'text', 'std' => 'Featured', 'label' => __('Featured Title:', 'marketify')), 'popular-title' => array('type' => 'text', 'std' => 'Popular', 'label' => __('Popular Title:', 'marketify')), 'number' => array('type' => 'number', 'step' => 1, 'min' => 1, 'max' => '', 'std' => 6, 'label' => __('Number to display:', 'marketify')), 'timeframe' => array('type' => 'select', 'std' => 'week', 'label' => __('Based on the current:', 'marketify'), 'options' => array('day' => __('Day', 'marketify'), 'week' => __('Week', 'marketify'), 'month' => __('Month', 'marketify'), 'year' => __('Year', 'marketify'))), 'scroll' => array('type' => 'checkbox', 'std' => 1, 'label' => __('Automatically scroll items', 'marketify')), 'speed' => array('type' => 'text', 'std' => 7000, 'label' => __('Slideshow Speed (ms)', 'marketify'))); parent::__construct(); }
/** * Constructor */ public function __construct() { $this->widget_cssclass = 'marketify_widget_curated_downloads'; $this->widget_description = sprintf(__('Display curated %s in a grid.', 'marketify'), edd_get_label_plural()); $this->widget_id = 'marketify_widget_curated_downloads'; $this->widget_name = sprintf(__('Marketify - Home: Curated %s', 'marketify'), edd_get_label_plural()); $this->settings = array('title' => array('type' => 'text', 'std' => edd_get_label_plural(), 'label' => __('Title:', 'marketify')), 'ids' => array('type' => 'text', 'std' => '', 'label' => sprintf(__('%s IDs:', 'marketify'), edd_get_label_singular())), 'columns' => array('type' => 'number', 'step' => 1, 'min' => 1, 'max' => 4, 'std' => 4, 'label' => __('Number of columns:', 'marketify')), 'description' => array('type' => 'textarea', 'std' => '', 'label' => __('Description:', 'marketify'))); parent::__construct(); }
/** * Render metabox * * @since 2.0 * @global object $post The post/page we are editing * @return void */ function edd_cr_render_meta_box($post_id) { global $post; $downloads = get_posts(array('post_type' => 'download', 'posts_per_page' => -1)); $restricted_to = get_post_meta($post->ID, '_edd_cr_restricted_to', true); if ($downloads) { ?> <div id="edd-cr-options" class="edd_meta_table_wrap"> <p><strong><?php echo sprintf(__('Restrict this content to buyers of one or more %s.', 'edd-cr'), strtolower(edd_get_label_plural())); ?> </strong></p> <table class="widefat edd_repeatable_table" width="100%" cellpadding="0" cellspacing="0"> <thead> <th><?php echo edd_get_label_singular(); ?> </th> <th><?php echo sprintf(__('%s Variation', 'edd-cr'), edd_get_label_singular()); ?> </th> <?php do_action('edd_cr_table_head', $post_id); ?> <th style="width: 2%"></th> </thead> <tbody> <?php if (!empty($restricted_to) && is_array($restricted_to)) { foreach ($restricted_to as $key => $value) { echo '<tr class="edd-cr-option-wrapper edd_repeatable_row" data-key="' . absint($key) . '">'; do_action('edd_cr_render_option_row', $key, $post_id); echo '</tr>'; } } else { echo '<tr class="edd-cr-option-wrapper edd_repeatable_row">'; do_action('edd_cr_render_option_row', 0, $post_id); echo '</tr>'; } ?> <tr> <td class="submit" colspan="4" style="float: none; clear:both; background:#fff;"> <a class="button-secondary edd_add_repeatable" style="margin: 6px 0;"><?php _e('Add New Download', 'edd-cr'); ?> </a> </td> </tr> </tbody> </table> </div> <?php } }
/** * Register all the meta boxes for the Download custom post type * * @since 1.0 * @return void */ function edd_add_download_meta_box() { /** Download Configuration */ add_meta_box('downloadinformation', sprintf(__('%1$s Configuration', 'edd'), edd_get_label_singular(), edd_get_label_plural()), 'edd_render_download_meta_box', 'download', 'normal', 'default'); /** Product Notes */ add_meta_box('edd_product_notes', __('Product Notes', 'edd'), 'edd_render_product_notes_meta_box', 'download', 'normal', 'default'); if (current_user_can('edit_product', get_the_ID())) { /** Download Stats */ add_meta_box('edd_download_stats', sprintf(__('%1$s Stats', 'edd'), edd_get_label_singular(), edd_get_label_plural()), 'edd_render_stats_meta_box', 'download', 'side', 'high'); } }
/** * Email Download Purchase Receipt * * Email the download link(s) and payment confirmation to the buyer. * * @access private * @since 1.0 * @return void */ function edd_email_purchase_receipt($payment_id, $admin_notice = true) { global $edd_options; $payment_data = edd_get_payment_meta($payment_id); $user_info = maybe_unserialize($payment_data['user_info']); if (isset($user_info['id']) && $user_info['id'] > 0) { $user_data = get_userdata($user_info['id']); $name = $user_data->display_name; } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { $name = $user_info['first_name'] . ' ' . $user_info['last_name']; } else { $name = $user_info['email']; } $message = edd_get_email_body_header(); $message .= edd_get_email_body_content($payment_id, $payment_data); $message .= edd_get_email_body_footer(); $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name'); $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email'); $subject = isset($edd_options['purchase_subject']) && strlen(trim($edd_options['purchase_subject'])) > 0 ? edd_email_template_tags($edd_options['purchase_subject'], $payment_data, $payment_id) : __('Purchase Receipt', 'edd'); $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n"; $headers .= "Reply-To: " . $from_email . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=utf-8\r\n"; // allow add-ons to add file attachments $attachments = apply_filters('edd_receipt_attachments', array(), $payment_id, $payment_data); wp_mail($payment_data['email'], $subject, $message, $headers, $attachments); if ($admin_notice) { /* send an email notification to the admin */ $admin_email = edd_get_admin_notice_emails(); $admin_subject = apply_filters('edd_admin_purchase_notification_subject', __('New download purchase', 'edd'), $payment_id, $payment_data); $admin_message = __('Hello', 'edd') . "\n\n" . sprintf(__('A %s purchase has been made', 'edd'), edd_get_label_plural()) . ".\n\n"; $admin_message .= sprintf(__('%s sold:', 'edd'), edd_get_label_plural()) . "\n\n"; $download_list = ''; $downloads = maybe_unserialize($payment_data['downloads']); if (is_array($downloads)) { foreach ($downloads as $download) { $id = isset($payment_data['cart_details']) ? $download['id'] : $download; $download_list .= html_entity_decode(get_the_title($id), ENT_COMPAT, 'UTF-8') . "\n"; } } $gateway = edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true)); $admin_message .= $download_list . "\n"; $admin_message .= __('Purchased by: ', 'edd') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n"; $admin_message .= __('Amount: ', 'edd') . " " . html_entity_decode(edd_currency_filter(edd_format_amount($payment_data['amount'])), ENT_COMPAT, 'UTF-8') . "\n\n"; $admin_message .= __('Payment Method: ', 'edd') . " " . $gateway . "\n\n"; $admin_message .= __('Thank you', 'edd'); $admin_message = apply_filters('edd_admin_purchase_notification', $admin_message, $payment_id, $payment_data); $admin_headers = apply_filters('edd_admin_purchase_notification_headers', array(), $payment_id, $payment_data); $admin_attachments = apply_filters('edd_admin_purchase_notification_attachments', array(), $payment_id, $payment_data); wp_mail($admin_email, $admin_subject, $admin_message, $admin_headers, $admin_attachments); } }
/** * Custom template tags for this theme. * * If the function is called directly in the theme or via * another function, it is wrapped to check if a child theme has * redefined it. Otherwise a child theme can unhook what is being attached. * * @package Marketify */ function marketify_downloads_section_title() { if (is_page_template('page-templates/popular.php')) { $cat = get_term(get_query_var('popular_cat'), 'download_category'); if (is_wp_error($cat)) { $base = ''; } else { $base = $cat->name; } printf(__('Popular %s', 'marketify'), $base); } else { $base = is_tax() ? single_term_title('', false) : edd_get_label_plural(); $order = get_query_var('m-orderby') ? sprintf(' ' . __('by %s', 'marketify'), marketify_edd_sorting_options(get_query_var('m-orderby'))) : ''; printf(__('All %s%s', 'marketify'), $base, $order); } }
function kjm_render_products_field($post_id) { $type = edd_get_download_type($post_id); $display = $type == 'bundle' ? '' : ' style="display:none;"'; $products = edd_get_bundled_products($post_id); ?> <div id="edd_products"<?php echo $display; ?> > <div id="edd_file_fields" class="edd_meta_table_wrap"> <table class="widefat" width="100%" cellpadding="0" cellspacing="0"> <thead> <tr> <th><?php printf(__('Bundled %s:', 'easy-digital-downloads'), edd_get_label_plural()); ?> </th> <?php do_action('edd_download_products_table_head', $post_id); ?> </tr> </thead> <tbody> <tr class="edd_repeatable_product_wrapper"> <td> <?php echo EDD()->html->product_dropdown(array('name' => '_edd_bundled_products[]', 'id' => 'edd_bundled_products', 'selected' => $products, 'multiple' => true, 'chosen' => true, 'bundles' => false, 'number' => 2)); ?> </td> <?php do_action('edd_download_products_table_row', $post_id); ?> </tr> </tbody> </table> </div> </div> <?php }
/** * Metabox * * @since 1.0 */ function edd_wl_add_meta_box() { if (current_user_can('view_shop_reports') || current_user_can('edit_product', get_the_ID())) { add_meta_box('edd_wish_list_products', sprintf(__('%1$s', 'edd'), edd_get_label_plural()), 'edd_wl_items_in_list_meta_box', 'edd_wish_list', 'normal', 'high'); } }
/** * Default Report Views * * @since 1.4 * @return array $views Report Views */ function edd_reports_default_views() { $views = array('earnings' => __('Earnings', 'easy-digital-downloads'), 'categories' => __('Earnings by Category', 'easy-digital-downloads'), 'downloads' => edd_get_label_plural(), 'gateways' => __('Payment Methods', 'easy-digital-downloads'), 'taxes' => __('Taxes', 'easy-digital-downloads')); $views = apply_filters('edd_report_views', $views); return $views; }
</a> </li> </ul> <input type="hidden" name="edd-payment-downloads-changed" id="edd-payment-downloads-changed" value="" /> <input type="hidden" name="edd-payment-removed" id="edd-payment-removed" value="{}" /> </div><!-- /.inside --> <?php } else { $key = 0; ?> <div class="row"> <p><?php printf(__('No %s included with this purchase', 'edd'), edd_get_label_plural()); ?> </p> </div> <?php } ?> </div><!-- /#edd-purchased-files --> <?php do_action('edd_view_order_details_files_after', $payment_id); ?> <?php do_action('edd_view_order_details_billing_before', $payment_id); ?>
/** * Sale Notification Template Body * * @since 1.7 * @author Daniel J Griffiths * @param int $payment_id Payment ID * @param array $payment_data Payment Data * @return string $email_body Body of the email */ function edd_get_sale_notification_body_content($payment_id = 0, $payment_data = array()) { global $edd_options; $user_info = maybe_unserialize($payment_data['user_info']); $email = edd_get_payment_user_email($payment_id); if (isset($user_info['id']) && $user_info['id'] > 0) { $user_data = get_userdata($user_info['id']); $name = $user_data->display_name; } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { $name = $user_info['first_name'] . ' ' . $user_info['last_name']; } else { $name = $email; } $download_list = ''; $downloads = maybe_unserialize($payment_data['downloads']); if (is_array($downloads)) { foreach ($downloads as $download) { $id = isset($payment_data['cart_details']) ? $download['id'] : $download; $title = get_the_title($id); if (isset($download['options'])) { if (isset($download['options']['price_id'])) { $title .= ' - ' . edd_get_price_option_name($id, $download['options']['price_id'], $payment_id); } } $download_list .= html_entity_decode($title, ENT_COMPAT, 'UTF-8') . "\n"; } } $gateway = edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true)); $default_email_body = __('Hello', 'edd') . "\n\n" . sprintf(__('A %s purchase has been made', 'edd'), edd_get_label_plural()) . ".\n\n"; $default_email_body .= sprintf(__('%s sold:', 'edd'), edd_get_label_plural()) . "\n\n"; $default_email_body .= $download_list . "\n\n"; $default_email_body .= __('Purchased by: ', 'edd') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n"; $default_email_body .= __('Amount: ', 'edd') . " " . html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8') . "\n"; $default_email_body .= __('Payment Method: ', 'edd') . " " . $gateway . "\n\n"; $default_email_body .= __('Thank you', 'edd'); $email = isset($edd_options['sale_notification']) ? stripslashes($edd_options['sale_notification']) : $default_email_body; //$email_body = edd_email_template_tags( $email, $payment_data, $payment_id, true ); $email_body = edd_do_email_tags($email, $payment_id); return apply_filters('edd_sale_notification', wpautop($email_body), $payment_id, $payment_data); }
do_action('edd_add_discount_form_before_excluded_products'); ?> <tr> <th scope="row" valign="top"> <label for="edd-excluded-products"><?php printf(__('Excluded %s', 'easy-digital-downloads'), edd_get_label_plural()); ?> </label> </th> <td> <?php echo EDD()->html->product_dropdown(array('name' => 'excluded-products[]', 'id' => 'excluded-products', 'selected' => array(), 'multiple' => true, 'chosen' => true, 'placeholder' => sprintf(__('Select one or more %s', 'easy-digital-downloads'), edd_get_label_plural()))); ?> <br/> <p class="description"><?php printf(__('%s that this discount code cannot be applied to.', 'easy-digital-downloads'), edd_get_label_plural()); ?> </p> </td> </tr> <?php do_action('edd_add_discount_form_before_start'); ?> <tr> <th scope="row" valign="top"> <label for="edd-start"><?php _e('Start date', 'easy-digital-downloads'); ?> </label> </th> <td>
/** * 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'); } }
/** * Downloads Shortcode * * This shortcodes uses the WordPress Query API to get downloads with the * arguments specified when using the shortcode. A list of the arguments * can be found from the EDD Dccumentation. The shortcode will take all the * paramaters and display the downloads queried in a valid HTML <div> tags. * * @since 1.0.6 * @internal Incomplete shortcode * @param array $atts Shortcode attributes * @param string $content * @return string $display Output generated from the downloads queried */ function edd_downloads_query($atts, $content = null) { extract(shortcode_atts(array('category' => '', 'exclude_category' => '', 'tags' => '', 'exclude_tags' => '', 'relation' => 'AND', 'number' => 10, 'price' => 'no', 'excerpt' => 'yes', 'full_content' => 'no', 'buy_button' => 'yes', 'columns' => 3, 'thumbnails' => 'true', 'orderby' => 'post_date', 'order' => 'DESC', 'ids' => ''), $atts)); $query = array('post_type' => 'download', 'posts_per_page' => absint($number), 'orderby' => $orderby, 'order' => $order); switch ($orderby) { case 'price': $orderby = 'meta_value'; $query['meta_key'] = 'edd_price'; $query['orderby'] = 'meta_value_num'; break; case 'title': $query['orderby'] = 'title'; break; case 'id': $query['orderby'] = 'ID'; break; case 'random': $query['orderby'] = 'rand'; break; default: $query['orderby'] = 'post_date'; break; } if ($tags || $category || $exclude_category || $exclude_tags) { $query['tax_query'] = array('relation' => $relation); if ($tags) { $query['tax_query'][] = array('taxonomy' => 'download_tag', 'terms' => explode(',', $tags), 'field' => 'slug'); } if ($category) { $query['tax_query'][] = array('taxonomy' => 'download_category', 'terms' => explode(',', $category), 'field' => 'slug'); } if ($exclude_category) { $query['tax_query'][] = array('taxonomy' => 'download_category', 'terms' => explode(',', $exclude_category), 'field' => 'slug', 'operator' => 'NOT IN'); } if ($exclude_tags) { $query['tax_query'][] = array('taxonomy' => 'download_tag', 'terms' => explode(',', $exclude_tags), 'field' => 'slug', 'operator' => 'NOT IN'); } } if (!empty($ids)) { $query['post__in'] = explode(',', $ids); } if (get_query_var('paged')) { $query['paged'] = get_query_var('paged'); } else { if (get_query_var('page')) { $query['paged'] = get_query_var('page'); } else { $query['paged'] = 1; } } switch (intval($columns)) { case 1: $column_width = '100%'; break; case 2: $column_width = '50%'; break; case 3: $column_width = '33%'; break; case 4: $column_width = '25%'; break; case 5: $column_width = '20%'; break; case 6: $column_width = '16.6%'; break; } // Allow the query to be manipulated by other plugins $query = apply_filters('edd_downloads_query', $query); $downloads = new WP_Query($query); if ($downloads->have_posts()) { $i = 1; ob_start(); ?> <div class="edd_downloads_list"> <?php while ($downloads->have_posts()) { $downloads->the_post(); ?> <div itemscope itemtype="http://schema.org/Product" class="edd_download" id="edd_download_<?php echo get_the_ID(); ?> " style="width: <?php echo $column_width; ?> ; float: left;"> <div class="edd_download_inner"> <?php do_action('edd_download_before'); if ('false' != $thumbnails) { edd_get_template_part('shortcode', 'content-image'); } edd_get_template_part('shortcode', 'content-title'); if ($excerpt == 'yes' && $full_content != 'yes') { edd_get_template_part('shortcode', 'content-excerpt'); } else { if ($full_content == 'yes') { edd_get_template_part('shortcode', 'content-full'); } } if ($price == 'yes') { edd_get_template_part('shortcode', 'content-price'); } if ($buy_button == 'yes') { edd_get_template_part('shortcode', 'content-cart-button'); } do_action('edd_download_after'); ?> </div> </div> <?php if ($i % $columns == 0) { ?> <div style="clear:both;"></div><?php } ?> <?php $i++; } ?> <div style="clear:both;"></div> <div id="edd_download_pagination" class="navigation"> <?php $big = 999999; echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, $query['paged']), 'total' => $downloads->max_num_pages)); ?> </div> <?php wp_reset_postdata(); ?> </div> <?php $display = ob_get_clean(); } else { $display = sprintf(_x('No %s found', 'download post type name', 'edd'), edd_get_label_plural()); } return apply_filters('downloads_shortcode', $display, $atts, $buy_button, $columns, $column_width, $downloads, $excerpt, $full_content, $price, $thumbnails, $query); }
/** * Get things started * * @since 1.4 * @uses EDD_Payment_History_Table::get_payment_counts() * @see WP_List_Table::__construct() */ public function __construct() { global $status, $page; // Set parent defaults parent::__construct(array('singular' => edd_get_label_singular(), 'plural' => edd_get_label_plural(), 'ajax' => false)); $this->get_payment_counts(); $this->process_bulk_action(); $this->base_url = admin_url('edit.php?post_type=download&page=edd-payment-history'); }
/** * View a customer * * @since 2.3 * @param $customer The Customer object being displayed * @return void */ function edd_customers_view($customer) { $customer_edit_role = apply_filters('edd_edit_customers_role', 'edit_shop_payments'); ?> <?php do_action('edd_customer_card_top', $customer); ?> <div class="info-wrapper customer-section"> <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=download&page=edd-customers&view=overview&id=' . $customer->id); ?> "> <div class="customer-info"> <div class="avatar-wrap left" id="customer-avatar"> <?php echo get_avatar($customer->email); ?> <br /> <?php if (current_user_can($customer_edit_role)) { ?> <span class="info-item editable customer-edit-link"><a title="<?php _e('Edit Customer', 'edd'); ?> " href="#" id="edit-customer"><?php _e('Edit Customer', 'edd'); ?> </a></span> <?php } ?> </div> <div class="customer-id right"> #<?php echo $customer->id; ?> </div> <div class="customer-address-wrapper right"> <?php if (isset($customer->user_id) && $customer->user_id > 0) { ?> <?php $address = get_user_meta($customer->user_id, '_edd_user_address', true); $defaults = array('line1' => '', 'line2' => '', 'city' => '', 'state' => '', 'country' => '', 'zip' => ''); $address = wp_parse_args($address, $defaults); ?> <?php if (!empty($address)) { ?> <strong><?php _e('Customer Address', 'edd'); ?> </strong> <span class="customer-address info-item editable"> <span class="info-item" data-key="line1"><?php echo $address['line1']; ?> </span> <span class="info-item" data-key="line2"><?php echo $address['line2']; ?> </span> <span class="info-item" data-key="city"><?php echo $address['city']; ?> </span> <span class="info-item" data-key="state"><?php echo $address['state']; ?> </span> <span class="info-item" data-key="country"><?php echo $address['country']; ?> </span> <span class="info-item" data-key="zip"><?php echo $address['zip']; ?> </span> </span> <?php } ?> <span class="customer-address info-item edit-item"> <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'edd'); ?> " value="<?php echo $address['line1']; ?> " /> <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'edd'); ?> " value="<?php echo $address['line2']; ?> " /> <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'edd'); ?> " value="<?php echo $address['city']; ?> " /> <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country edd-select edit-item"> <?php $selected_country = $address['country']; $countries = edd_get_country_list(); foreach ($countries as $country_code => $country) { echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>'; } ?> </select> <?php $selected_state = edd_get_shop_state(); $states = edd_get_shop_states($selected_country); $selected_state = isset($address['state']) ? $address['state'] : $selected_state; if (!empty($states)) { ?> <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state edd-select info-item"> <?php foreach ($states as $state_code => $state) { echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>'; } ?> </select> <?php } else { ?> <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state edd-input info-item" placeholder="<?php _e('State / Province', 'edd'); ?> "/> <?php } ?> <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'edd'); ?> " value="<?php echo $address['zip']; ?> " /> </span> <?php } ?> </div> <div class="customer-main-wrapper left"> <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?> " placeholder="<?php _e('Customer Name', 'edd'); ?> " /></span> <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?> </span></span> <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?> " placeholder="<?php _e('Customer Email', 'edd'); ?> " /></span> <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?> </span> <span class="customer-since info-item"> <?php _e('Customer since', 'edd'); ?> <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)); ?> </span> <span class="customer-user-id info-item edit-item"> <?php $user_id = $customer->user_id > 0 ? $customer->user_id : ''; $data_atts = array('key' => 'user_login', 'exclude' => $user_id); $user_args = array('name' => 'customerinfo[user_login]', 'class' => 'edd-user-dropdown', 'data' => $data_atts); if (!empty($user_id)) { $userdata = get_userdata($user_id); $user_args['value'] = $userdata->user_login; } echo EDD()->html->ajax_user_search($user_args); ?> <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?> " /> </span> <span class="customer-user-id info-item editable"> <?php _e('User ID', 'edd'); ?> : <?php if (intval($customer->user_id) > 0) { ?> <span data-key="user_id"><?php echo $customer->user_id; ?> </span> <?php } else { ?> <span data-key="user_id"><?php _e('none', 'edd'); ?> </span> <?php } ?> <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?> <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'edd'); ?> "><?php _e('Disconnect User', 'edd'); ?> </a></span> <?php } ?> </span> </div> </div> <span id="customer-edit-actions" class="edit-item"> <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?> " /> <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> <input type="hidden" name="edd_action" value="edit-customer" /> <input type="submit" id="edd-edit-customer-save" class="button-secondary" value="<?php _e('Update Customer', 'edd'); ?> " /> <a id="edd-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'edd'); ?> </a> </span> </form> </div> <?php do_action('edd_customer_before_stats', $customer); ?> <div id="customer-stats-wrapper" class="customer-section"> <ul> <li> <a title="<?php _e('View All Purchases', 'edd'); ?> " href="<?php echo admin_url('edit.php?post_type=download&page=edd-payment-history&user='******'%d Completed Sale', '%d Completed Sales', $customer->purchase_count, 'edd'), $customer->purchase_count); ?> </a> </li> <li> <span class="dashicons dashicons-chart-area"></span> <?php echo edd_currency_filter(edd_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Value', 'edd'); ?> </li> <?php do_action('edd_customer_stats_list', $customer); ?> </ul> </div> <?php do_action('edd_customer_before_tables_wrapper', $customer); ?> <div id="customer-tables-wrapper" class="customer-section"> <?php do_action('edd_customer_before_tables', $customer); ?> <h3><?php _e('Recent Payments', 'edd'); ?> </h3> <?php $payment_ids = explode(',', $customer->payment_ids); $payments = edd_get_payments(array('post__in' => $payment_ids)); $payments = array_slice($payments, 0, 10); ?> <table class="wp-list-table widefat striped payments"> <thead> <tr> <th><?php _e('ID', 'edd'); ?> </th> <th><?php _e('Amount', 'edd'); ?> </th> <th><?php _e('Date', 'edd'); ?> </th> <th><?php _e('Status', 'edd'); ?> </th> <th><?php _e('Actions', 'edd'); ?> </th> </tr> </thead> <tbody> <?php if (!empty($payments)) { ?> <?php foreach ($payments as $payment) { ?> <tr> <td><?php echo $payment->ID; ?> </td> <td><?php echo edd_payment_amount($payment->ID); ?> </td> <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?> </td> <td><?php echo edd_get_payment_status($payment, true); ?> </td> <td> <a title="<?php _e('View Details for Payment', 'edd'); echo ' ' . $payment->ID; ?> " href="<?php echo admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $payment->ID); ?> "> <?php _e('View Details', 'edd'); ?> </a> <?php do_action('edd_customer_recent_purcahses_actions', $customer, $payment); ?> </td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="5"><?php _e('No Payments Found', 'edd'); ?> </td></tr> <?php } ?> </tbody> </table> <h3><?php printf(__('Purchased %s', 'edd'), edd_get_label_plural()); ?> </h3> <?php $downloads = edd_get_users_purchased_products($customer->email); ?> <table class="wp-list-table widefat striped downloads"> <thead> <tr> <th><?php echo edd_get_label_singular(); ?> </th> <th width="120px"><?php _e('Actions', 'edd'); ?> </th> </tr> </thead> <tbody> <?php if (!empty($downloads)) { ?> <?php foreach ($downloads as $download) { ?> <tr> <td><?php echo $download->post_title; ?> </td> <td> <a title="<?php echo esc_attr(sprintf(__('View %s', 'edd'), $download->post_title)); ?> " href="<?php echo esc_url(admin_url('post.php?action=edit&post=' . $download->ID)); ?> "> <?php printf(__('View %s', 'edd'), edd_get_label_singular()); ?> </a> </td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="2"><?php printf(__('No %s Found', 'edd'), edd_get_label_plural()); ?> </td></tr> <?php } ?> </tbody> </table> <?php do_action('edd_customer_after_tables', $customer); ?> </div> <?php do_action('edd_customer_card_bottom', $customer); ?> <?php }
/** * Render Getting Started Screen * * @access public * @since 1.9 * @return void */ public function getting_started_screen() { list($display_version) = explode('-', EDD_VERSION); ?> <div class="wrap about-wrap"> <h1><?php printf(__('Welcome to Easy Digital Downloads %s', 'edd'), $display_version); ?> </h1> <div class="about-text"><?php printf(__('Thank you for updating to the latest version! Easy Digital Downloads %s is ready to make your online store faster, safer and better!', 'edd'), $display_version); ?> </div> <div class="edd-badge"><img src="<?php echo EDD_PLUGIN_URL . 'assets/images/edd-logo.svg'; ?> " alt="<?php _e('Easy Digital Downloads', 'edd'); ?> " / ></div> <?php $this->tabs(); ?> <p class="about-description"><?php _e('Use the tips below to get started using Easy Digital Downloads. You will be up and running in no time!', 'edd'); ?> </p> <div class="changelog"> <h3><?php _e('Creating Your First Download Product', 'edd'); ?> </h3> <div class="feature-section"> <img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/edit-download.png'; ?> " class="edd-welcome-screenshots"/> <h4><?php printf(__('<a href="%s">%s → Add New</a>', 'edd'), admin_url('post-new.php?post_type=download'), edd_get_label_plural()); ?> </h4> <p><?php printf(__('The %s menu is your access point for all aspects of your Easy Digital Downloads product creation and setup. To create your first product, simply click Add New and then fill out the product details.', 'edd'), edd_get_label_plural()); ?> </p> <h4><?php _e('Product Price', 'edd'); ?> </h4> <p><?php _e('Products can have simple prices or variable prices if you wish to have more than one price point for a product. For a single price, simply enter the price. For multiple price points, click <em>Enable variable pricing</em> and enter the options.', 'edd'); ?> </p> <h4><?php _e('Download Files', 'edd'); ?> </h4> <p><?php _e('Uploading the downloadable files is simple. Click <em>Upload File</em> in the Download Files section and choose your download file. To add more than one file, simply click the <em>Add New</em> button.', 'edd'); ?> </p> </div> </div> <div class="changelog"> <h3><?php _e('Display a Product Grid', 'edd'); ?> </h3> <div class="feature-section"> <img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/grid.png'; ?> " class="edd-welcome-screenshots"/> <h4><?php _e('Flexible Product Grids', 'edd'); ?> </h4> <p><?php _e('The [downloads] shortcode will display a product grid that works with any theme, no matter the size. It is even responsive!', 'edd'); ?> </p> <h4><?php _e('Change the Number of Columns', 'edd'); ?> </h4> <p><?php _e('You can easily change the number of columns by adding the columns="x" parameter:', 'edd'); ?> </p> <p><pre>[downloads columns="4"]</pre></p> <h4><?php _e('Additional Display Options', 'edd'); ?> </h4> <p><?php printf(__('The product grids can be customized in any way you wish and there is <a href="%s">extensive documentation</a> to assist you.', 'edd'), 'http://easydigitaldownloads.com/documentation'); ?> </p> </div> </div> <div class="changelog"> <h3><?php _e('Purchase Buttons Anywhere', 'edd'); ?> </h3> <div class="feature-section"> <img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/purchase-link.png'; ?> " class="edd-welcome-screenshots"/> <h4><?php _e('The <em>[purchase_link]</em> Shortcode', 'edd'); ?> </h4> <p><?php _e('With easily accessible shortcodes to display purchase buttons, you can add a Buy Now or Add to Cart button for any product anywhere on your site in seconds.', 'edd'); ?> </p> <h4><?php _e('Buy Now Buttons', 'edd'); ?> </h4> <p><?php _e('Purchase buttons can behave as either Add to Cart or Buy Now buttons. With Buy Now buttons customers are taken straight to PayPal, giving them the most frictionless purchasing experience possible.', 'edd'); ?> </p> </div> </div> <div class="changelog"> <h3><?php _e('Need Help?', 'edd'); ?> </h3> <div class="feature-section"> <h4><?php _e('Phenomenal Support', 'edd'); ?> </h4> <p><?php _e('We do our best to provide the best support we can. If you encounter a problem or have a question, post a question in the <a href="https://easydigitaldownloads.com/support">support forums</a>.', 'edd'); ?> </p> <h4><?php _e('Need Even Faster Support?', 'edd'); ?> </h4> <p><?php _e('Our <a href="https://easydigitaldownloads.com/support/pricing/">Priority Support forums</a> are there for customers that need faster and/or more in-depth assistance.', 'edd'); ?> </p> </div> </div> <div class="changelog"> <h3><?php _e('Stay Up to Date', 'edd'); ?> </h3> <div class="feature-section"> <h4><?php _e('Get Notified of Extension Releases', 'edd'); ?> </h4> <p><?php _e('New extensions that make Easy Digital Downloads even more powerful are released nearly every single week. Subscribe to the newsletter to stay up to date with our latest releases. <a href="http://eepurl.com/kaerz" target="_blank">Sign up now</a> to ensure you do not miss a release!', 'edd'); ?> </p> <h4><?php _e('Get Alerted About New Tutorials', 'edd'); ?> </h4> <p><?php _e('<a href="http://eepurl.com/kaerz" target="_blank">Sign up now</a> to hear about the latest tutorial releases that explain how to take Easy Digital Downloads further.', 'edd'); ?> </p> </div> </div> <div class="changelog"> <h3><?php _e('Extensions for Everything', 'edd'); ?> </h3> <div class="feature-section"> <h4><?php _e('Over 250 Extensions', 'edd'); ?> </h4> <p><?php _e('Add-on plugins are available that greatly extend the default functionality of Easy Digital Downloads. There are extensions for payment processors, such as Stripe and PayPal, extensions for newsletter integrations, and many, many more.', 'edd'); ?> </p> <h4><?php _e('Visit the Extension Store', 'edd'); ?> </h4> <p><?php _e('<a href="https://easydigitaldownloads.com/extensions" target="_blank">The Extensions store</a> has a list of all available extensions, including convenient category filters so you can find exactly what you are looking for.', 'edd'); ?> </p> </div> </div> </div> <?php }
foreach ($downloads as $download) { echo '<option value="' . esc_attr($download->ID) . '">' . esc_html(get_the_title($download->ID)) . '</option>'; } } ?> </select> <p class="description"><?php printf(__('%s required to be purchased for this discount.', 'edd'), edd_get_label_plural()); ?> </p> <p> <label for="edd-non-global-discount"> <input type="checkbox" id="edd-non-global-discount" name="not_global" value="1"/> <?php printf(__('Apply discount only to selected %s?', 'edd'), edd_get_label_plural()); ?> </label> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="edd-start"><?php _e('Start date', 'edd'); ?> </label> </th> <td> <input name="start" id="edd-start" type="text" value="" style="width: 120px;" class="edd_datepicker"/> <p class="description"><?php
/** * Updated bulk messages * * @since 2.3 * @param array $bulk_messages Post updated messages * @param array $bulk_counts Post counts * @return array $bulk_messages New post updated messages */ function edd_bulk_updated_messages($bulk_messages, $bulk_counts) { $singular = edd_get_label_singular(); $plural = edd_get_label_plural(); $bulk_messages['download'] = array('updated' => sprintf(_n('%1$s %2$s updated.', '%1$s %3$s updated.', $bulk_counts['updated'], 'easy-digital-downloads'), $bulk_counts['updated'], $singular, $plural), 'locked' => sprintf(_n('%1$s %2$s not updated, somebody is editing it.', '%1$s %3$s not updated, somebody is editing them.', $bulk_counts['locked'], 'easy-digital-downloads'), $bulk_counts['locked'], $singular, $plural), 'deleted' => sprintf(_n('%1$s %2$s permanently deleted.', '%1$s %3$s permanently deleted.', $bulk_counts['deleted'], 'easy-digital-downloads'), $bulk_counts['deleted'], $singular, $plural), 'trashed' => sprintf(_n('%1$s %2$s moved to the Trash.', '%1$s %3$s moved to the Trash.', $bulk_counts['trashed'], 'easy-digital-downloads'), $bulk_counts['trashed'], $singular, $plural), 'untrashed' => sprintf(_n('%1$s %2$s restored from the Trash.', '%1$s %3$s restored from the Trash.', $bulk_counts['untrashed'], 'easy-digital-downloads'), $bulk_counts['untrashed'], $singular, $plural)); return $bulk_messages; }
/** * Downloads Shortcode * * This shortcodes uses the WordPress Query API to get downloads with the * arguments specified when using the shortcode. A list of the arguments * can be found from the EDD Dccumentation. The shortcode will take all the * parameters and display the downloads queried in a valid HTML <div> tags. * * @since 1.0.6 * @internal Incomplete shortcode * @param array $atts Shortcode attributes * @param string $content * @return string $display Output generated from the downloads queried */ function edd_downloads_query($atts, $content = null) { $atts = shortcode_atts(array('category' => '', 'exclude_category' => '', 'tags' => '', 'exclude_tags' => '', 'relation' => 'OR', 'number' => 9, 'price' => 'no', 'excerpt' => 'yes', 'full_content' => 'no', 'buy_button' => 'yes', 'columns' => 3, 'thumbnails' => 'true', 'orderby' => 'post_date', 'order' => 'DESC', 'ids' => '', 'pagination' => 'true'), $atts, 'downloads'); $query = array('post_type' => 'download', 'orderby' => $atts['orderby'], 'order' => $atts['order']); if ('true' === $atts['pagination']) { $query['posts_per_page'] = (int) $atts['number']; if ($query['posts_per_page'] < 0) { $query['posts_per_page'] = abs($query['posts_per_page']); } } else { $query['nopaging'] = true; } switch ($atts['orderby']) { case 'price': $atts['orderby'] = 'meta_value'; $query['meta_key'] = 'edd_price'; $query['orderby'] = 'meta_value_num'; break; case 'title': $query['orderby'] = 'title'; break; case 'id': $query['orderby'] = 'ID'; break; case 'random': $query['orderby'] = 'rand'; break; default: $query['orderby'] = 'post_date'; break; } if ($atts['tags'] || $atts['category'] || $atts['exclude_category'] || $atts['exclude_tags']) { $query['tax_query'] = array('relation' => $atts['relation']); if ($atts['tags']) { $tag_list = explode(',', $atts['tags']); foreach ($tag_list as $tag) { if (is_numeric($tag)) { $term_id = $tag; } else { $term = get_term_by('slug', $tag, 'download_tag'); if (!$term) { continue; } $term_id = $term->term_id; } $query['tax_query'][] = array('taxonomy' => 'download_tag', 'field' => 'term_id', 'terms' => $term_id); } } if ($atts['category']) { $categories = explode(',', $atts['category']); foreach ($categories as $category) { if (is_numeric($category)) { $term_id = $category; } else { $term = get_term_by('slug', $category, 'download_category'); if (!$term) { continue; } $term_id = $term->term_id; } $query['tax_query'][] = array('taxonomy' => 'download_category', 'field' => 'term_id', 'terms' => $term_id); } } if ($atts['exclude_category']) { $categories = explode(',', $atts['exclude_category']); foreach ($categories as $category) { if (is_numeric($category)) { $term_id = $category; } else { $term = get_term_by('slug', $category, 'download_category'); if (!$term) { continue; } $term_id = $term->term_id; } $query['tax_query'][] = array('taxonomy' => 'download_category', 'field' => 'term_id', 'terms' => $term_id, 'operator' => 'NOT IN'); } } if ($atts['exclude_tags']) { $tag_list = explode(',', $atts['exclude_tags']); foreach ($tag_list as $tag) { if (is_numeric($tag)) { $term_id = $tag; } else { $term = get_term_by('slug', $tag, 'download_tag'); if (!$term) { continue; } $term_id = $term->term_id; } $query['tax_query'][] = array('taxonomy' => 'download_tag', 'field' => 'term_id', 'terms' => $term_id, 'operator' => 'NOT IN'); } } } if ($atts['exclude_tags'] || $atts['exclude_category']) { $query['tax_query']['relation'] = 'AND'; } if (!empty($atts['ids'])) { $query['post__in'] = explode(',', $atts['ids']); } if (get_query_var('paged')) { $query['paged'] = get_query_var('paged'); } else { if (get_query_var('page')) { $query['paged'] = get_query_var('page'); } else { $query['paged'] = 1; } } switch (intval($atts['columns'])) { case 0: $column_width = 'inherit'; break; case 1: $column_width = '100%'; break; case 2: $column_width = '50%'; break; case 3: $column_width = '33%'; break; case 4: $column_width = '25%'; break; case 5: $column_width = '20%'; break; case 6: $column_width = '16.6%'; break; default: $column_width = '33%'; break; } // Allow the query to be manipulated by other plugins $query = apply_filters('edd_downloads_query', $query, $atts); $downloads = new WP_Query($query); if ($downloads->have_posts()) { $i = 1; $wrapper_class = 'edd_download_columns_' . $atts['columns']; ob_start(); ?> <div class="edd_downloads_list <?php echo apply_filters('edd_downloads_list_wrapper_class', $wrapper_class, $atts); ?> "> <?php while ($downloads->have_posts()) { $downloads->the_post(); ?> <?php $schema = edd_add_schema_microdata() ? 'itemscope itemtype="http://schema.org/Product" ' : ''; ?> <div <?php echo $schema; ?> class="<?php echo apply_filters('edd_download_class', 'edd_download', get_the_ID(), $atts, $i); ?> " id="edd_download_<?php echo get_the_ID(); ?> " style="width: <?php echo $column_width; ?> ; float: left;"> <div class="edd_download_inner"> <?php do_action('edd_download_before'); if ('false' != $atts['thumbnails']) { edd_get_template_part('shortcode', 'content-image'); do_action('edd_download_after_thumbnail'); } edd_get_template_part('shortcode', 'content-title'); do_action('edd_download_after_title'); if ($atts['excerpt'] == 'yes' && $atts['full_content'] != 'yes') { edd_get_template_part('shortcode', 'content-excerpt'); do_action('edd_download_after_content'); } else { if ($atts['full_content'] == 'yes') { edd_get_template_part('shortcode', 'content-full'); do_action('edd_download_after_content'); } } if ($atts['price'] == 'yes') { edd_get_template_part('shortcode', 'content-price'); do_action('edd_download_after_price'); } if ($atts['buy_button'] == 'yes') { edd_get_template_part('shortcode', 'content-cart-button'); } do_action('edd_download_after'); ?> </div> </div> <?php if ($atts['columns'] != 0 && $i % $atts['columns'] == 0) { ?> <div style="clear:both;"></div><?php } ?> <?php $i++; } ?> <div style="clear:both;"></div> <?php wp_reset_postdata(); ?> <?php $pagination = false; if (is_single()) { $pagination = paginate_links(apply_filters('edd_download_pagination_args', array('base' => get_permalink() . '%#%', 'format' => '?paged=%#%', 'current' => max(1, $query['paged']), 'total' => $downloads->max_num_pages), $atts, $downloads, $query)); } else { $big = 999999; $search_for = array($big, '#038;'); $replace_with = array('%#%', '&'); $pagination = paginate_links(apply_filters('edd_download_pagination_args', array('base' => str_replace($search_for, $replace_with, get_pagenum_link($big)), 'format' => '?paged=%#%', 'current' => max(1, $query['paged']), 'total' => $downloads->max_num_pages), $atts, $downloads, $query)); } ?> <?php if (!empty($pagination)) { ?> <div id="edd_download_pagination" class="navigation"> <?php echo $pagination; ?> </div> <?php } ?> </div> <?php $display = ob_get_clean(); } else { $display = sprintf(_x('No %s found', 'download post type name', 'easy-digital-downloads'), edd_get_label_plural()); } return apply_filters('downloads_shortcode', $display, $atts, $atts['buy_button'], $atts['columns'], $column_width, $downloads, $atts['excerpt'], $atts['full_content'], $atts['price'], $atts['thumbnails'], $query); }
/** * Form * * @return void * @since 1.0 */ function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $show_count = isset($instance['show_count']) ? esc_attr($instance['show_count']) : 0; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'edd-widgets-pack'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> "/> </p> <p> <input id="<?php echo $this->get_field_id('show_count'); ?> " name="<?php echo $this->get_field_name('show_count'); ?> " type="checkbox" value="1" <?php checked('1', $show_count); ?> /> <label for="<?php echo $this->get_field_id('show_count'); ?> "><?php printf(__('Show %s counts?', 'edd-widgets-pack'), edd_get_label_plural(true)); ?> </label> </p> <?php }
</a> </li> </ul> <input type="hidden" name="edd-payment-downloads-changed" id="edd-payment-downloads-changed" value="" /> <input type="hidden" name="edd-payment-removed" id="edd-payment-removed" value="{}" /> </div><!-- /.inside --> <?php } else { $key = 0; ?> <div class="row"> <p><?php printf(__('No %s included with this purchase', 'easy-digital-downloads'), edd_get_label_plural()); ?> </p> </div> <?php } ?> </div><!-- /#edd-purchased-files --> <?php do_action('edd_view_order_details_files_after', $payment_id); ?> <?php do_action('edd_view_order_details_billing_before', $payment_id); ?>