/**
 * Adds the Contextual Help for the main Downloads page
 *
 * @since 1.2.3
 * @return void
 */
function edd_downloads_contextual_help()
{
    $screen = get_current_screen();
    if ($screen->id != 'download') {
        return;
    }
    $screen->set_help_sidebar('<p><strong>' . sprintf(__('For more information:', 'edd') . '</strong></p>' . '<p>' . sprintf(__('Visit the <a href="%s">documentation</a> on the Easy Digital Downloads website.', 'edd'), esc_url('https://easydigitaldownloads.com/documentation/'))) . '</p>' . '<p>' . sprintf(__('<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>. View <a href="%s">extensions</a> or <a href="%s">themes</a>.', 'edd'), esc_url('https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues'), esc_url('https://github.com/easydigitaldownloads/Easy-Digital-Downloads'), esc_url('https://easydigitaldownloads.com/extensions/'), esc_url('https://easydigitaldownloads.com/themes/')) . '</p>');
    $screen->add_help_tab(array('id' => 'edd-download-configuration', 'title' => sprintf(__('%s Settings', 'edd'), edd_get_label_singular()), 'content' => '<p>' . __('<strong>File Download Limit</strong> - Define how many times customers are allowed to download their purchased files. Leave at 0 for unlimited. Resending the purchase receipt will permit the customer one additional download if their limit has already been reached.', 'edd') . '</p>' . '<p>' . __('<strong>Accounting Options</strong> - If enabled, define an individual SKU or product number for this download.', 'edd') . '</p>' . '<p>' . __('<strong>Button Options</strong> - Disable the automatic output the purchase button. If disabled, no button will be added to the download page unless the <code>[purchase_link]</code> shortcode is used.', 'edd') . '</p>'));
    $screen->add_help_tab(array('id' => 'edd-download-prices', 'title' => sprintf(__('%s Prices', 'edd'), edd_get_label_singular()), 'content' => '<p>' . __('<strong>Enable variable pricing</strong> - By enabling variable pricing, multiple download options and prices can be configured.', 'edd') . '</p>' . '<p>' . __('<strong>Enable multi-option purchases</strong> - By enabling multi-option purchases customers can add multiple variable price items to their cart at once.', 'edd') . '</p>'));
    $screen->add_help_tab(array('id' => 'edd-download-files', 'title' => sprintf(__('%s Files', 'edd'), edd_get_label_singular()), 'content' => '<p>' . __('<strong>Product Type Options</strong> - Choose a default product type or a bundle. Bundled products automatically include access other download&#39;s files when purchased.', 'edd') . '</p>' . '<p>' . __('<strong>File Downloads</strong> - Define download file names and their respsective file URL. Multiple files can be assigned to a single price, or variable prices.', 'edd') . '</p>'));
    $screen->add_help_tab(array('id' => 'edd-product-notes', 'title' => sprintf(__('%s Notes', 'edd'), edd_get_label_singular()), 'content' => '<p>' . __('Special notes or instructions for the product. These notes will be added to the purchase receipt, and additionaly may be used by some extensions or themes on the frontend.', 'edd') . '</p>'));
    $colors = array('gray', 'pink', 'blue', 'green', 'teal', 'black', 'dark gray', 'orange', 'purple', 'slate');
    $screen->add_help_tab(array('id' => 'edd-purchase-shortcode', 'title' => __('Purchase Shortcode', 'edd'), 'content' => '<p>' . __('<strong>Purchase Shortcode</strong> - If the automatic output of the purchase button has been disabled via the Download Configuration box, a shortcode can be used to output the button or link.', 'edd') . '</p>' . '<p><code>[purchase_link id="#" price="1" text="Add to Cart" color="blue"]</code></p>' . '<ul>
				<li><strong>id</strong> - ' . __('The ID of a specific download to purchase.', 'edd') . '</li>
				<li><strong>price</strong> - ' . __('Whether to show the price on the purchase button. 1 to show the price, 0 to disable it.', 'edd') . '</li>
				<li><strong>text</strong> - ' . __('The text to be displayed on the button or link.', 'edd') . '</li>
				<li><strong>style</strong> - ' . __('<em>button</em> | <em>text</em> - The style of the purchase link.', 'edd') . '</li>
				<li><strong>color</strong> - <em>' . implode('</em> | <em>', $colors) . '</em></li>
				<li><strong>class</strong> - ' . __('One or more custom CSS classes you want applied to the button.', 'edd') . '</li>
			</ul>' . '<p>' . sprintf(__('For more information, see <a href="%s">using Shortcodes</a> on the WordPress.org Codex or <a href="%s">Easy Digital Downloads Documentation</a>', 'edd'), 'https://codex.wordpress.org/Shortcode', 'https://easydigitaldownloads.com/docs/display-purchase-buttons-purchase_link/') . '</p>'));
    /**
     * Fires off in the EDD Downloads Contextual Help Screen
     * 
     * @since 1.2.3
     * @param object $screen The current admin screen
     */
    do_action('edd_downloads_contextual_help', $screen);
}
/**
 * Payments contextual help.
 *
 * @access      private
 * @since       1.4
 * @return      void
 */
function edd_payments_contextual_help()
{
    $screen = get_current_screen();
    if ($screen->id != 'download_page_edd-payment-history') {
        return;
    }
    $screen->set_help_sidebar('<p><strong>' . sprintf(__('For more information:', 'edd') . '</strong></p>' . '<p>' . sprintf(__('Visit the <a href="%s">documentation</a> on the Easy Digital Downloads website.', 'edd'), esc_url('https://easydigitaldownloads.com/documentation/'))) . '</p>' . '<p>' . sprintf(__('<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>. View <a href="%s">extensions</a> or <a href="%s">themes</a>.', 'edd'), esc_url('https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues'), esc_url('https://github.com/easydigitaldownloads/Easy-Digital-Downloads'), esc_url('https://easydigitaldownloads.com/extensions/'), esc_url('https://easydigitaldownloads.com/themes/')) . '</p>');
    $screen->add_help_tab(array('id' => 'edd-payments-overview', 'title' => __('Overview', 'edd'), 'content' => '<p>' . __("This screen provides access to all of your store's transactions.", 'edd') . '</p>' . '<p>' . __('Payments can be searched by email address, user name, or filtered by status (completed, pending, etc.)', 'edd') . '</p>' . '<p>' . __('You also have the option to bulk delete payment should you wish.', 'edd') . '</p>'));
    $screen->add_help_tab(array('id' => 'edd-payments-search', 'title' => __('Search Payments', 'edd'), 'content' => '<p>' . __('The payment history can be searched in several different ways:', 'edd') . '</p>' . '<ul>
				<li>' . __('You can enter the customer\'s email address', 'edd') . '</li>
				<li>' . __('You can enter the customer\'s name or ID prefexed by \'user:\'', 'edd') . '</li>
				<li>' . __('You can enter the 32-character purchase key', 'edd') . '</li>
				<li>' . __('You can enter the purchase ID', 'edd') . '</li>
				<li>' . __('You can enter a transaction ID prefixed by \'txn:\'', 'edd') . '</li>
				<li>' . sprintf(__('You can enter the %s ID prefixed by \'#\'', 'edd'), edd_get_label_singular()) . '</li>
			</ul>'));
    $screen->add_help_tab(array('id' => 'edd-payments-details', 'title' => __('Payment Details', 'edd'), 'content' => '<p>' . __('Each payment can be further inspected by clicking the corresponding <em>View Order Details</em> link. This will provide more information including:', 'edd') . '</p>' . '<ul>
				<li><strong>Purchased File</strong> - ' . __('The file associated with the purchase.', 'edd') . '</li>
				<li><strong>Purchase Date</strong> - ' . __('The exact date and time the payment was completed.', 'edd') . '</li>
				<li><strong>Discount Used</strong> - ' . __('If a coupon or discount was used during the checkout process.', 'edd') . '</li>
				<li><strong>Name</strong> - ' . __("The buyer's name.", 'edd') . '</li>
				<li><strong>Email</strong> - ' . __("The buyer's email address.", 'edd') . '</li>
				<li><strong>Payment Notes</strong> - ' . __('Any customer-specific notes related to the payment.', 'edd') . '</li>
				<li><strong>Payment Method</strong> - ' . __('The name of the payment gateway used to complete the payment.', 'edd') . '</li>
				<li><strong>Purchase Key</strong> - ' . __('A unique key used to identify the payment.', 'edd') . '</li>
			</ul>'));
    do_action('edd_payments_contextual_help', $screen);
}
     *

     * @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
  *
  * @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();
 }
/**
 * 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, 'publicly_queryable' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_nav_menu' => false, 'query_var' => false, 'rewrite' => false, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => false, 'supports' => array('title'), 'menu_icon' => EDD_PLUGIN_URL . 'includes/images/media-button.png');
    register_post_type('edd_payment', $payment_args);
}
 /**
  * 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));
     add_action('edd_log_view_actions', array($this, 'downloads_filter'));
 }
 /**
  * Setup the data that is going to be tracked
  *
  * @access private
  * @return void
  */
 private function setup_data()
 {
     $data = array();
     // Retrieve current theme info
     $theme_data = wp_get_theme();
     $theme = $theme_data->Name . ' ' . $theme_data->Version;
     $data['url'] = home_url();
     $data['theme'] = $theme;
     $data['email'] = get_bloginfo('admin_email');
     // Retrieve current plugin information
     if (!function_exists('get_plugins')) {
         include ABSPATH . '/wp-admin/includes/plugin.php';
     }
     $plugins = array_keys(get_plugins());
     $active_plugins = get_option('active_plugins', array());
     foreach ($plugins as $key => $plugin) {
         if (in_array($plugin, $active_plugins)) {
             // Remove active plugins from list so we can show active and inactive separately
             unset($plugins[$key]);
         }
     }
     $data['active_plugins'] = $active_plugins;
     $data['inactive_plugins'] = $plugins;
     $data['products'] = wp_count_posts('download')->publish;
     $data['download_label'] = edd_get_label_singular(true);
     $this->data = $data;
 }
 /**
  * Renders an HTML Dropdown of all the Products (Downloads)
  *
  * @access public
  * @since 1.5
  * @param array $args Arguments for the dropdown
  * @return string $output Product dropdown
  */
 public function product_dropdown($args = array())
 {
     $defaults = array('name' => 'products', 'id' => 'products', 'class' => '', 'multiple' => false, 'selected' => 0, 'chosen' => false, 'number' => 30, 'bundles' => true, 'placeholder' => sprintf(__('Select a %s', 'edd'), edd_get_label_singular()));
     $args = wp_parse_args($args, $defaults);
     $product_args = array('post_type' => 'download', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => $args['number']);
     // Maybe disable bundles
     if (!$args['bundles']) {
         $product_args['meta_query'] = array('relation' => 'AND', array('key' => '_edd_product_type', 'value' => 'bundle', 'compare' => 'NOT EXISTS'));
     }
     $products = get_posts($product_args);
     $options = array();
     if ($products) {
         $options[0] = sprintf(__('Select a %s', 'edd'), edd_get_label_singular());
         foreach ($products as $product) {
             $options[absint($product->ID)] = esc_html($product->post_title);
         }
     } else {
         $options[0] = __('No products found', 'edd');
     }
     // This ensures that any selected products are included in the drop down
     if (is_array($args['selected'])) {
         foreach ($args['selected'] as $item) {
             if (!in_array($item, $options)) {
                 $options[$item] = get_the_title($item);
             }
         }
     } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
         if (!in_array($args['selected'], $options)) {
             $options[$args['selected']] = get_the_title($args['selected']);
         }
     }
     $output = $this->select(array('name' => $args['name'], 'selected' => $args['selected'], 'id' => $args['id'], 'class' => $args['class'], 'options' => $options, 'chosen' => $args['chosen'], 'multiple' => $args['multiple'], 'placeholder' => $args['placeholder'], 'show_option_all' => false, 'show_option_none' => false));
     return $output;
 }
/**
 * Disable the add_to_cart action
 *
 * @since       1.1.0
 * @param       int $download_id The ID of this download
 * @return      void
 */
function edd_external_products_pre_add_to_cart($download_id = 0)
{
    $url = get_post_meta($download_id, '_edd_external_product_url', true);
    if ($url) {
        wp_die(sprintf(__('This %1$s can only be purchased from %2$s!', 'edd-external-products'), strtolower(edd_get_label_singular()), esc_url($url)), '', array('back_link' => true));
    }
}
 /**
  * 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();
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->widget_cssclass = 'mashshare_edd_widget_stats';
     $this->widget_description = sprintf(__('Display useful statistics about a %s.', 'mashshare-edd'), edd_get_label_singular());
     $this->widget_id = 'mashshare_edd_widget_stats';
     $this->widget_name = sprintf(__('%s Stats', 'mashshare-edd'), edd_get_label_singular());
     $this->settings = array('title' => array('label' => __('Title', 'mashshare-edd'), 'type' => 'text', 'std' => ''));
     parent::__construct();
 }
 /**
  * Construct
  *
  * @return   void
  * @since    1.0
  */
 function __construct()
 {
     // hook updates
     add_action('save_post', array(&$this, 'delete_cache'));
     add_action('delete_post', array(&$this, 'delete_cache'));
     add_action('update_option_start_of_week', array(&$this, 'delete_cache'));
     add_action('update_option_gmt_offset', array(&$this, 'delete_cache'));
     // construct widget
     parent::__construct(false, sprintf(__('EDD %s Calendar', 'edd-widgets-pack'), edd_get_label_singular()), array('description' => sprintf(__('A calendar of your site\'s EDD %s.', 'edd-widgets-pack'), edd_get_label_plural(true))));
 }
/**
 * Add a notification bar for admins
 *
 * @since       1.0.0
 * @param       string $the_content The post content
 * @return      string $the_content The updated post content
 */
function edd_vault_display_admin_notice($the_content)
{
    if (isset($GLOBALS['post']) && $GLOBALS['post']->post_type == 'download') {
        $status = array_values(edd_vault_is_stored($GLOBALS['post']->ID));
        if (in_array(true, $status)) {
            $the_content = '<div class="edd-vault-notice"><p>' . edd_get_option('vault_notice_text', sprintf(__('This %s is currently in the vault.', 'edd-vault'), edd_get_label_singular(true))) . '</p></div>' . $the_content;
        }
    }
    return $the_content;
}
/**
 * Export metabox
 *
 * @since Astoundify Crowdfunding 0.1-alpha
 *
 * @return void
 */
function atcf_campaign_export_box()
{
    ?>
	<div class="metabox-holder">
		<div id="post-body">
			<div id="post-body-content">
				<div class="postbox">
					<h3><span><?php 
    _e('Export Campaign Data', 'atcf');
    ?>
</span></h3>
					<div class="inside">
						<p><?php 
    _e('Download a CSV of all pledges recorded.', 'atcf');
    ?>
</p>
						<p>
							<form method="post">
								<select name="edd_export_campaign_id">
									<option value="0"><?php 
    printf(__('Select %s', 'atcf'), edd_get_label_singular());
    ?>
</option>

									<?php 
    $campaigns = get_posts(array('post_type' => 'download', 'posts_per_page' => -1));
    foreach ($campaigns as $campaign) {
        $_campaign = atcf_get_campaign($campaign);
        if (apply_filters('atcf_export_filter_completed', !$_campaign->is_funded() && 'fixed' == $_campaign->type())) {
            continue;
        }
        echo '<option value="' . $campaign->ID . '">' . $campaign->post_title . '</option>';
    }
    ?>
								</select>
								<input type="hidden" name="edd-action" value="export_campaign"/>
								<input type="submit" value="<?php 
    _e('Generate CSV', 'atcf');
    ?>
" class="button-secondary"/>
							</form>
						</p>
					</div><!-- .inside -->
				</div><!-- .postbox -->
			</div><!-- .post-body-content -->
		</div><!-- .post-body -->
	</div><!-- .metabox-holder -->
	<?php 
}
Beispiel #16
0
/**
 * EDD Sidebars and Widgets
 *
 * @since Marketify 1.2
 *
 * @return void
 */
function marketify_edd_widgets_init()
{
    register_widget('Marketify_Widget_Recent_Downloads');
    register_widget('Marketify_Widget_Curated_Downloads');
    register_widget('Marketify_Widget_Featured_Popular_Downloads');
    register_widget('Marketify_Widget_Download_Details');
    register_widget('Marketify_Widget_Download_Share');
    register_widget('Marketify_Widget_Download_Archive_Sorting');
    register_widget('Marketify_Widget_Downloads_Taxonomy');
    register_widget('Marketify_Widget_Taxonomy_Stylized');
    if (class_exists('EDD_Reviews')) {
        register_widget('Marketify_Widget_Download_Review_Details');
    }
    /* Download Achive (archive-download.php) */
    register_sidebar(array('name' => sprintf(__('%s Archive Sidebar', 'marketify'), edd_get_label_singular()), 'id' => 'sidebar-download', 'before_widget' => '<aside id="%1$s" class="widget download-archive-widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="download-archive-widget-title">', 'after_title' => '</h1>'));
    /* Download Single (single-download.php) */
    register_sidebar(array('name' => sprintf(__('%s Single Sidebar', 'marketify'), edd_get_label_singular()), 'id' => 'sidebar-download-single', 'before_widget' => '<aside id="%1$s" class="widget download-single-widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="download-single-widget-title">', 'after_title' => '</h1>'));
    /* Download Single Comments/Reviews (single-download.php) */
    register_sidebar(array('name' => sprintf(__('%s Single Comments Sidebar', 'marketify'), edd_get_label_singular()), 'id' => 'sidebar-download-single-comments', 'before_widget' => '<aside id="%1$s" class="widget download-single-widget comments %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="download-single-widget-title">', 'after_title' => '</h1>'));
}
/**
 * Add vault status content (category/tag)
 *
 * @since       1.0.0
 * @param       string $c Null
 * @param       string $column The column we are working with
 * @param       int $id The item ID
 * @return      void
 */
function edd_vault_dashboard_taxonomy_column_content($c, $column, $id)
{
    switch ($column) {
        case 'vault-status':
            if ($_GET['taxonomy'] == 'download_category') {
                $title = sprintf(__('%s Category Is', 'edd-vault'), edd_get_label_singular());
                $icon = 'category';
            } else {
                $title = sprintf(__('%s Tag Is', 'edd-vault'), edd_get_label_singular());
                $icon = 'tag';
            }
            if (edd_vault_is_stored($id, $_GET['taxonomy'])) {
                $status = ' edd-vault-status-stored';
                $title .= ' ' . __('In Vault', 'edd-vault');
            } else {
                $status = '';
                $title .= ' ' . __('Not In Vault', 'edd-vault');
            }
            echo '<span class="dashicons dashicons-' . $icon . $status . '" title="' . $title . '"></span>';
            break;
    }
}
 /**
  * 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');
 }
/**
 * 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;
}
    /**
     * Render the extra meta box fields
     *
     * @since 1.0
     *
     * @access private
     * @return void
     */
    public function metabox($post_id = 0)
    {
        global $edd_options;
        $enabled = get_post_meta($post_id, '_edd_enable_shipping', true);
        $display = $enabled ? '' : 'style="display:none;"';
        $domestic = get_post_meta($post_id, '_edd_shipping_domestic', true);
        $international = get_post_meta($post_id, '_edd_shipping_international', true);
        ?>
		<div id="edd_simple_shipping">
			<script type="text/javascript">jQuery(document).ready(function($) {$('#edd_enable_shipping').on('click',function() {$('#edd_simple_shipping_fields,.edd_prices_shipping').toggle();});});</script>
			<p><strong><?php 
        _e('Shipping Options', 'edd-simple-shipping');
        ?>
</strong></p>
			<p>
				<label for="edd_enable_shipping">
					<input type="checkbox" name="_edd_enable_shipping" id="edd_enable_shipping" value="1"<?php 
        checked(1, $enabled);
        ?>
/>
					<?php 
        printf(__('Enable shipping for this %s', 'edd-simple-shipping'), edd_get_label_singular());
        ?>
				</label>
			</p>
			<div id="edd_simple_shipping_fields" <?php 
        echo $display;
        ?>
>
				<table>
					<tr>
						<td>
							<label for="edd_shipping_domestic"><?php 
        _e('Domestic Rate:', 'edd-simple-shipping');
        ?>
&nbsp;</label>
						</td>
						<td>
							<?php 
        if (!isset($edd_options['currency_position']) || $edd_options['currency_position'] == 'before') {
            ?>
								<span><?php 
            echo edd_currency_filter('');
            ?>
</span><input type="number" min="0" step="0.01" class="small-text" value="<?php 
            esc_attr_e($domestic);
            ?>
" id="edd_shipping_domestic" name="_edd_shipping_domestic"/>
							<?php 
        } else {
            ?>
								<input type="number" min="0" step="0.01" class="small-text" value="<?php 
            esc_attr_e($domestic);
            ?>
" id="edd_shipping_domestic" name="_edd_shipping_domestic"/><?php 
            echo edd_currency_filter('');
            ?>
							<?php 
        }
        ?>
						</td>
						<td>
							<label for="edd_shipping_international"><?php 
        _e('International Rate:', 'edd-simple-shipping');
        ?>
&nbsp;</label>
						</td>
						<td>
							<?php 
        if (!isset($edd_options['currency_position']) || $edd_options['currency_position'] == 'before') {
            ?>
								<span><?php 
            echo edd_currency_filter('');
            ?>
</span><input type="number" min="0" step="0.01" class="small-text" value="<?php 
            esc_attr_e($international);
            ?>
" id="edd_shipping_international" name="_edd_shipping_international"/>
							<?php 
        } else {
            ?>
								<input type="number" min="0" step="0.01" class="small-text" value="<?php 
            esc_attr_e($international);
            ?>
" id="edd_shipping_international" name="_edd_shipping_international"/><?php 
            echo edd_currency_filter('');
            ?>
							<?php 
        }
        ?>
						</td>
					</tr>
				</table>
			</div>
		</div>
<?php 
    }
Beispiel #21
0
/**
 * 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');
    ?>
:&nbsp;
						<?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 
}
/**
 * Admin Footer For Thickbox
 *
 * Prints the footer code needed for the Insert Download
 * TinyMCE button.
 *
 * @since 1.0
 * @global $pagenow
 * @global $typenow
 * @return void
 */
function edd_admin_footer_for_thickbox()
{
    global $pagenow, $typenow;
    // Only run in post/page creation and edit screens
    if (in_array($pagenow, array('post.php', 'page.php', 'post-new.php', 'post-edit.php')) && $typenow != 'download') {
        ?>
		<script type="text/javascript">
            function insertDownload() {
                var id = jQuery('#products').val(),
                    direct = jQuery('#select-edd-direct').val(),
                    style = jQuery('#select-edd-style').val(),
                    color = jQuery('#select-edd-color').is(':visible') ? jQuery('#select-edd-color').val() : '',
                    text = jQuery('#edd-text').val() || '<?php 
        _e("Purchase", "edd");
        ?>
';

                // Return early if no download is selected
                if ('' === id) {
                    alert('<?php 
        _e("You must choose a download", "edd");
        ?>
');
                    return;
                }

                if( '2' == direct ) {
                	direct = ' direct="true"';
                } else {
                	direct = '';
                }

                // Send the shortcode to the editor
                window.send_to_editor('[purchase_link id="' + id + '" style="' + style + '" color="' + color + '" text="' + text + '"' + direct +']');
            }
            jQuery(document).ready(function ($) {
                $('#select-edd-style').change(function () {
                    if ($(this).val() === 'button') {
                        $('#edd-color-choice').slideDown();
                    } else {
                        $('#edd-color-choice').slideUp();
                    }
                });
            });
		</script>

		<div id="choose-download" style="display: none;">
			<div class="wrap" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
				<p><?php 
        echo sprintf(__('Use the form below to insert the short code for purchasing a %s', 'edd'), edd_get_label_singular());
        ?>
</p>
				<div>
					<?php 
        echo EDD()->html->product_dropdown(array('chosen' => true));
        ?>
				</div>
				<?php 
        if (edd_shop_supports_buy_now()) {
            ?>
					<div>
						<select id="select-edd-direct" style="clear: both; display: block; margin-bottom: 1em; margin-top: 1em;">
							<option value="0"><?php 
            _e('Choose the button behavior', 'edd');
            ?>
</option>
							<option value="1"><?php 
            _e('Add to Cart', 'edd');
            ?>
</option>
							<option value="2"><?php 
            _e('Direct Purchase Link', 'edd');
            ?>
</option>
						</select>
					</div>
				<?php 
        }
        ?>
				<div>
					<select id="select-edd-style" style="clear: both; display: block; margin-bottom: 1em; margin-top: 1em;">
						<option value=""><?php 
        _e('Choose a style', 'edd');
        ?>
</option>
						<?php 
        $styles = array('button', 'text link');
        foreach ($styles as $style) {
            echo '<option value="' . $style . '">' . $style . '</option>';
        }
        ?>
					</select>
				</div>
				<?php 
        $colors = edd_get_button_colors();
        if ($colors) {
            ?>
				<div id="edd-color-choice" style="display: none;">
					<select id="select-edd-color" style="clear: both; display: block; margin-bottom: 1em;">
						<option value=""><?php 
            _e('Choose a button color', 'edd');
            ?>
</option>
						<?php 
            foreach ($colors as $key => $color) {
                echo '<option value="' . str_replace(' ', '_', $key) . '">' . $color['label'] . '</option>';
            }
            ?>
					</select>
				</div>
				<?php 
        }
        ?>
				<div>
					<input type="text" class="regular-text" id="edd-text" value="" placeholder="<?php 
        _e('Link text . . .', 'edd');
        ?>
"/>
				</div>
				<p class="submit">
					<input type="button" id="edd-insert-download" class="button-primary" value="<?php 
        echo sprintf(__('Insert %s', 'edd'), edd_get_label_singular());
        ?>
" onclick="insertDownload();" />
					<a id="edd-cancel-download-insert" class="button-secondary" onclick="tb_remove();" title="<?php 
        _e('Cancel', 'edd');
        ?>
"><?php 
        _e('Cancel', 'edd');
        ?>
</a>
				</p>
			</div>
		</div>
	<?php 
    }
}
Beispiel #23
0
/**
 * Render Accounting Options
 *
 * @since 1.6
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_accounting_options($post_id)
{
    if (!edd_use_skus()) {
        return;
    }
    $edd_sku = get_post_meta($post_id, 'edd_sku', true);
    ?>
		<p><strong><?php 
    _e('Accounting Options:', 'edd');
    ?>
</strong></p>
		<p>
			<label for="edd_sku">
				<?php 
    echo EDD()->html->text(array('name' => 'edd_sku', 'value' => $edd_sku, 'class' => 'small-text'));
    ?>
				<?php 
    echo sprintf(__('Enter an SKU for this %s.', 'edd'), strtolower(edd_get_label_singular()));
    ?>
			</label>
		</p>
<?php 
}
 /**
  * Retrieve the table columns
  *
  * @access public
  * @since 1.5
  * @return array $columns Array of all the list table columns
  */
 public function get_columns()
 {
     $columns = array('title' => edd_get_label_singular(), 'sales' => __('Sales', 'easy-digital-downloads'), 'earnings' => __('Earnings', 'easy-digital-downloads'), 'average_sales' => __('Monthly Average Sales', 'easy-digital-downloads'), 'average_earnings' => __('Monthly Average Earnings', 'easy-digital-downloads'), 'details' => __('Detailed Report', 'easy-digital-downloads'));
     return $columns;
 }
    /** @see WP_Widget::form */
    public function form($instance)
    {
        // Set up some default widget settings.
        $defaults = array('title' => sprintf(__('%s Details', 'easy-digital-downloads'), edd_get_label_singular()), 'display_type' => 'current', 'download_id' => false, 'download_title' => 'on', 'purchase_button' => 'on', 'categories' => 'on', 'tags' => 'on');
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>

		<?php 
        if ('current' === $instance['download_id']) {
            $instance['display_type'] = 'current';
            $instance['download_id'] = false;
        } elseif (is_numeric($instance['download_id'])) {
            $instance['display_type'] = 'specific';
        }
        ?>

		<!-- Title -->
		<p>
			<label for="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
"><?php 
        _e('Title:', 'easy-digital-downloads');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('title'));
        ?>
" type="text" value="<?php 
        echo $instance['title'];
        ?>
" />
		</p>

		<p>
			<?php 
        _e('Display Type:', 'easy-digital-downloads');
        ?>
<br />
			<input type="radio" onchange="jQuery(this).parent().next('.download-details-selector').hide();" <?php 
        checked('current', $instance['display_type'], true);
        ?>
 value="current" name="<?php 
        echo esc_attr($this->get_field_name('display_type'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('display_type'));
        ?>
-current"><label for="<?php 
        echo esc_attr($this->get_field_id('display_type'));
        ?>
-current"><?php 
        _e('Current', 'easy-digital-downloads');
        ?>
</label>
			<input type="radio" onchange="jQuery(this).parent().next('.download-details-selector').show();" <?php 
        checked('specific', $instance['display_type'], true);
        ?>
 value="specific" name="<?php 
        echo esc_attr($this->get_field_name('display_type'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('display_type'));
        ?>
-specific"><label for="<?php 
        echo esc_attr($this->get_field_id('display_type'));
        ?>
-specific"><?php 
        _e('Specific', 'easy-digital-downloads');
        ?>
</label>
		</p>

		<!-- Download -->
		<?php 
        $display = 'current' === $instance['display_type'] ? ' style="display: none;"' : '';
        ?>
		<p class="download-details-selector" <?php 
        echo $display;
        ?>
>
		<label for="<?php 
        echo esc_attr($this->get_field_id('download_id'));
        ?>
"><?php 
        printf(__('%s:', 'easy-digital-downloads'), edd_get_label_singular());
        ?>
</label>
		<?php 
        $download_count = wp_count_posts('download');
        ?>
		<?php 
        if ($download_count->publish < 1000) {
            ?>
			<?php 
            $args = array('post_type' => 'download', 'posts_per_page' => -1, 'post_status' => 'publish');
            $downloads = get_posts($args);
            ?>
			<select class="widefat" name="<?php 
            echo esc_attr($this->get_field_name('download_id'));
            ?>
" id="<?php 
            echo esc_attr($this->get_field_id('download_id'));
            ?>
">
			<?php 
            foreach ($downloads as $download) {
                ?>
				<option <?php 
                selected(absint($instance['download_id']), $download->ID);
                ?>
 value="<?php 
                echo esc_attr($download->ID);
                ?>
"><?php 
                echo $download->post_title;
                ?>
</option>
			<?php 
            }
            ?>
			</select>
		<?php 
        } else {
            ?>
			<br />
			<input type="text" value="<?php 
            echo esc_attr($instance['download_id']);
            ?>
" placeholder="<?php 
            printf(__('%s ID', 'easy-digital-downloads'), edd_get_label_singular());
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('download_id'));
            ?>
" id="<?php 
            echo esc_attr($this->get_field_id('download_id'));
            ?>
">
		<?php 
        }
        ?>
		</p>

		<!-- Download title -->
		<p>
			<input <?php 
        checked($instance['download_title'], 'on');
        ?>
 id="<?php 
        echo esc_attr($this->get_field_id('download_title'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('download_title'));
        ?>
" type="checkbox" />
			<label for="<?php 
        echo esc_attr($this->get_field_id('download_title'));
        ?>
"><?php 
        _e('Show Title', 'easy-digital-downloads');
        ?>
</label>
		</p>

		<!-- Show purchase button -->
		<p>
			<input <?php 
        checked($instance['purchase_button'], 'on');
        ?>
 id="<?php 
        echo esc_attr($this->get_field_id('purchase_button'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('purchase_button'));
        ?>
" type="checkbox" />
			<label for="<?php 
        echo esc_attr($this->get_field_id('purchase_button'));
        ?>
"><?php 
        _e('Show Purchase Button', 'easy-digital-downloads');
        ?>
</label>
		</p>

		<!-- Show download categories -->
		<p>
			<?php 
        $category_labels = edd_get_taxonomy_labels('download_category');
        ?>
			<input <?php 
        checked($instance['categories'], 'on');
        ?>
 id="<?php 
        echo esc_attr($this->get_field_id('categories'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('categories'));
        ?>
" type="checkbox" />
			<label for="<?php 
        echo esc_attr($this->get_field_id('categories'));
        ?>
"><?php 
        printf(__('Show %s', 'easy-digital-downloads'), $category_labels['name']);
        ?>
</label>
		</p>

		<!-- Show download tags -->
		<p>
			<?php 
        $tag_labels = edd_get_taxonomy_labels('download_tag');
        ?>
			<input <?php 
        checked($instance['tags'], 'on');
        ?>
 id="<?php 
        echo esc_attr($this->get_field_id('tags'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('tags'));
        ?>
" type="checkbox" />
			<label for="<?php 
        echo esc_attr($this->get_field_id('tags'));
        ?>
"><?php 
        printf(__('Show %s', 'easy-digital-downloads'), $tag_labels['name']);
        ?>
</label>
		</p>

		<?php 
        do_action('edd_product_details_widget_form', $instance);
        ?>
	<?php 
    }
:&nbsp;</span>
												<input type="number" id="edd-order-download-quantity" class="small-text" min="1" step="1" value="1" />
											</li>
											<?php 
    }
    ?>

											<li class="price">
												<?php 
    echo EDD()->html->text(array('name' => 'edd-order-download-amount', 'id' => 'edd-order-download-amount', 'label' => __('Item Price: ', 'edd'), 'class' => 'small-text edd-order-download-price'));
    ?>
											</li>

											<li class="actions">
												<a href="" id="edd-order-add-download" class="button button-secondary"><?php 
    printf(__('Add %s to Payment', 'edd'), edd_get_label_singular());
    ?>
</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">
 /**
  * Retrieve the table columns
  *
  * @access public
  * @since 1.4
  * @return array $columns Array of all the list table columns
  */
 public function get_columns()
 {
     $columns = array('ID' => __('Log ID', 'easy-digital-downloads'), 'download' => edd_get_label_singular(), 'user_id' => __('User', 'easy-digital-downloads'), 'payment_id' => __('Payment ID', 'easy-digital-downloads'), 'file' => __('File', 'easy-digital-downloads'), 'ip' => __('IP Address', 'easy-digital-downloads'), 'date' => __('Date', 'easy-digital-downloads'));
     return $columns;
 }
        /**
         * Add Metabox
         *
         * @since 1.0
         */
        function add_metabox($post_id)
        {
            $checked = (bool) get_post_meta($post_id, '_edd_hide_download', true);
            $is_redirect = (bool) get_post_meta($post_id, '_edd_hide_redirect_download', true);
            ?>
			<p><strong><?php 
            apply_filters('edd_hide_download_header', printf(__('Hide %s', 'edd-hd'), edd_get_label_singular()));
            ?>
</strong></p>
			<p>
				<label for="edd_hide_download">
					<input type="checkbox" name="_edd_hide_download" id="edd_hide_download" value="1" <?php 
            checked(true, $checked);
            ?>
 />
					<?php 
            apply_filters('edd_hide_download_label', printf(__('Hide this %s', 'edd-hd'), strtolower(edd_get_label_singular())));
            ?>
				
				</label>
			</p>
			<p>
				<label for="edd_hide_redirect_download">
					<input type="checkbox" name="_edd_hide_redirect_download" id="edd_hide_redirect_download" value="1" <?php 
            checked(true, $is_redirect);
            ?>
 />
						<?php 
            apply_filters('edd_hide_download_disable_access_label', printf(__('Disable direct access to this %s', 'edd-hd'), strtolower(edd_get_label_singular())));
            ?>
				</label>
			</p>

		<?php 
        }
 /**
  * Construct
  *
  * @return   void
  * @since    1.0
  */
 function __construct()
 {
     parent::__construct(false, sprintf(__('EDD Random %s', 'edd-widgets-pack'), edd_get_label_singular()), array('description' => sprintf(__('A random EDD %s.', 'edd-widgets-pack'), edd_get_label_singular(true))));
 }
printf(__('Enter the discount amount in %s', 'easy-digital-downloads'), edd_get_currency());
?>
</p>
					<p class="description edd-amount-description percent-discount"><?php 
_e('Enter the discount percentage. 10 = 10%', 'easy-digital-downloads');
?>
</p>
				</td>
			</tr>
			<?php 
do_action('edd_add_discount_form_before_products');
?>
			<tr>
				<th scope="row" valign="top">
					<label for="edd-products"><?php 
printf(__('%s Requirements', 'easy-digital-downloads'), edd_get_label_singular());
?>
</label>
				</th>
				<td>
					<p>
						<?php 
echo EDD()->html->product_dropdown(array('name' => 'products[]', 'id' => 'products', 'multiple' => true, 'chosen' => true, 'placeholder' => sprintf(__('Select one or more %s', 'easy-digital-downloads'), edd_get_label_plural())));
?>
<br/>
					</p>
					<div id="edd-discount-product-conditions" style="display:none;">
						<p>
							<select id="edd-product-condition" name="product_condition">
								<option value="all"><?php 
printf(__('Cart must contain all selected %s', 'easy-digital-downloads'), edd_get_label_plural());