示例#1
0
    /** @see WP_Widget::form */
    public function form($instance)
    {
        // Set up some default widget settings.
        $defaults = array('title' => sprintf(__('%s Details', 'edd'), edd_get_label_singular()), 'download_id' => 'current', 'download_title' => 'on', 'purchase_button' => 'on', 'categories' => 'on', 'tags' => 'on');
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>

		<!-- Title -->
		<p>
			<label for="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
"><?php 
        _e('Title:', 'edd');
        ?>
</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>

			<!-- Download -->
		 <?php 
        $args = array('post_type' => 'download', 'posts_per_page' => -1, 'post_status' => 'publish');
        $downloads = get_posts($args);
        ?>
		<p>
			<label for="<?php 
        echo esc_attr($this->get_field_id('download_id'));
        ?>
"><?php 
        printf(__('%s', 'edd'), edd_get_label_singular());
        ?>
</label>
			<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'));
        ?>
">
				<option value="current"><?php 
        _e('Use current', 'edd');
        ?>
</option>
			<?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>
		</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', 'edd');
        ?>
</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', 'edd');
        ?>
</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', 'edd'), $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', 'edd'), $tag_labels['name']);
        ?>
</label>
		</p>

		<?php 
        do_action('edd_product_details_widget_form', $instance);
        ?>
	<?php 
    }
    /** @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 
    }
 /**
  * Renders an HTML Dropdown of all the Categories
  *
  * @access public
  * @since 1.5.2
  * @param string $name Name attribute of the dropdown
  * @param int    $selected Category to select automatically
  * @return string $output Category dropdown
  */
 public function category_dropdown($name = 'edd_categories', $selected = 0)
 {
     $categories = get_terms('download_category', apply_filters('edd_category_dropdown', array()));
     $options = array();
     foreach ($categories as $category) {
         $options[absint($category->term_id)] = esc_html($category->name);
     }
     $category_labels = edd_get_taxonomy_labels('download_category');
     $output = $this->select(array('name' => $name, 'selected' => $selected, 'options' => $options, 'show_option_all' => sprintf(_x('All %s', 'plural: Example: "All Categories"', 'edd'), $category_labels['name']), 'show_option_none' => false));
     return $output;
 }
/**
 * Add Download Filters
 *
 * Adds taxonomy drop down filters for downloads.
 *
 * @since 1.0
 * @return void
 */
function edd_add_download_filters()
{
    global $typenow;
    // Checks if the current post type is 'download'
    if ($typenow == 'download') {
        $terms = get_terms('download_category');
        if (count($terms) > 0) {
            echo "<select name='download_category' id='download_category' class='postform'>";
            $category_labels = edd_get_taxonomy_labels('download_category');
            echo "<option value=''>" . sprintf(__('Show all %s', 'easy-digital-downloads'), strtolower($category_labels['name'])) . "</option>";
            foreach ($terms as $term) {
                $selected = isset($_GET['download_category']) && $_GET['download_category'] == $term->slug ? ' selected="selected"' : '';
                echo '<option value="' . esc_attr($term->slug) . '"' . $selected . '>' . esc_html($term->name) . ' (' . $term->count . ')</option>';
            }
            echo "</select>";
        }
        $terms = get_terms('download_tag');
        if (count($terms) > 0) {
            echo "<select name='download_tag' id='download_tag' class='postform'>";
            $tag_labels = edd_get_taxonomy_labels('download_tag');
            echo "<option value=''>" . sprintf(__('Show all %s', 'easy-digital-downloads'), strtolower($tag_labels['name'])) . "</option>";
            foreach ($terms as $term) {
                $selected = isset($_GET['download_tag']) && $_GET['download_tag'] == $term->slug ? ' selected="selected"' : '';
                echo '<option value="' . esc_attr($term->slug) . '"' . $selected . '>' . esc_html($term->name) . ' (' . $term->count . ')</option>';
            }
            echo "</select>";
        }
        if (isset($_REQUEST['all_posts']) && '1' === $_REQUEST['all_posts']) {
            echo '<input type="hidden" name="all_posts" value="1" />';
        } else {
            if (!current_user_can('view_shop_reports')) {
                $author_id = get_current_user_id();
                echo '<input type="hidden" name="author" value="' . esc_attr($author_id) . '" />';
            }
        }
    }
}
/**
 * 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)
{
    if (!current_user_can('view_shop_reports')) {
        wp_die(__('You do not have permission to generate PDF sales reports', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
    }
    if (!wp_verify_nonce($_GET['_wpnonce'], 'edd_generate_pdf')) {
        wp_die(__('Nonce verification failed', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
    }
    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', 'easy-digital-downloads')) . ' ' . 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', 'easy-digital-downloads')));
    $pdf->SetAuthor(utf8_decode(__('Easy Digital Downloads', 'easy-digital-downloads')));
    $pdf->SetCreator(utf8_decode(__('Easy Digital Downloads', 'easy-digital-downloads')));
    $pdf->Image(EDD_PLUGIN_URL . 'assets/images/edd-logo-pdf.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', 'easy-digital-downloads')), 0, 2, 'L', false);
    $pdf->SetFont('Helvetica', '', 13);
    $pdf->Ln();
    $pdf->SetTextColor(150, 150, 150);
    $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'easy-digital-downloads')) . $daterange, 0, 2, 'L', false);
    $pdf->Ln();
    $pdf->SetTextColor(50, 50, 50);
    $pdf->SetFont('Helvetica', '', 14);
    $pdf->Cell(0, 10, utf8_decode(__('Table View', 'easy-digital-downloads')), 0, 2, 'L', false);
    $pdf->SetFont('Helvetica', '', 12);
    $pdf->SetFillColor(238, 238, 238);
    $pdf->Cell(70, 6, utf8_decode(__('Product Name', 'easy-digital-downloads')), 1, 0, 'L', true);
    $pdf->Cell(30, 6, utf8_decode(__('Price', 'easy-digital-downloads')), 1, 0, 'L', true);
    $category_labels = edd_get_taxonomy_labels('download_category');
    $pdf->Cell(50, 6, utf8_decode($category_labels['name']), 1, 0, 'L', true);
    $pdf->Cell(50, 6, utf8_decode(__('Tags', 'easy-digital-downloads')), 1, 0, 'L', true);
    $pdf->Cell(45, 6, utf8_decode(__('Number of Sales', 'easy-digital-downloads')), 1, 0, 'L', true);
    $pdf->Cell(35, 6, utf8_decode(__('Earnings to Date', 'easy-digital-downloads')), 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);
            $earnings = html_entity_decode(edd_currency_filter(edd_get_download_earnings_stats($download->ID)));
            if (function_exists('iconv')) {
                // Ensure characters like euro; are properly converted. See GithuB issue #472 and #1570
                $price = iconv('UTF-8', 'windows-1252', utf8_encode($price));
                $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
            }
            $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
        }
    } else {
        $pdf->SetWidths(array(280));
        $title = utf8_decode(sprintf(__('No %s found.', 'easy-digital-downloads'), 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', 'easy-digital-downloads')), 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(apply_filters('edd_sales_earnings_pdf_export_filename', 'edd-report-' . date_i18n('Y-m-d')) . '.pdf', 'D');
}
    /** @see WP_Widget::form */
    function form($instance)
    {
        // Set up some default widget settings.
        $defaults = array('title' => '', 'subtitle' => '', 'taxonomy' => 'download_category', 'orderby' => 'rand', 'order' => 'ASC', 'count' => 6, 'display' => 'Grid', 'column' => 4, 'show_count' => '', 'pagination' => '', 'hide_empty' => '', 'include' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>

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

    <p>
      <label for="<?php 
        echo $this->get_field_id('subtitle');
        ?>
"><?php 
        _e('Sub Title:', 'musik');
        ?>
</label>
      <input type="text" class="widefat" id="<?php 
        echo $this->get_field_id('subtitle');
        ?>
" name="<?php 
        echo $this->get_field_name('subtitle');
        ?>
" value="<?php 
        echo $instance['subtitle'];
        ?>
" />
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('taxonomy');
        ?>
"><?php 
        _e('Taxonomy:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('taxonomy'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('taxonomy'));
        ?>
">
        <?php 
        $category_labels = function_exists('edd_get_taxonomy_labels') ? edd_get_taxonomy_labels('download_category') : 'Category';
        $tag_labels = function_exists('edd_get_taxonomy_labels') ? edd_get_taxonomy_labels('download_tag') : 'Tag';
        ?>
        <option value="download_category" <?php 
        selected('download_category', $instance['taxonomy']);
        ?>
><?php 
        echo $category_labels['name'];
        ?>
</option>
        <option value="download_tag" <?php 
        selected('download_tag', $instance['taxonomy']);
        ?>
><?php 
        echo $tag_labels['name'];
        ?>
</option>
        <option value="download_artist" <?php 
        selected('download_artist', $instance['taxonomy']);
        ?>
><?php 
        echo __('Artist', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('orderby');
        ?>
"><?php 
        _e('Order by:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('orderby'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('orderby'));
        ?>
">
        <option value="name" <?php 
        selected('name', $instance['orderby']);
        ?>
><?php 
        _e('Name', 'musik');
        ?>
</option>
        <option value="count" <?php 
        selected('count', $instance['orderby']);
        ?>
><?php 
        _e('Count', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('order');
        ?>
"><?php 
        _e('Order:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('order'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('order'));
        ?>
">
        <option value="ASC" <?php 
        selected('ASC', $instance['order']);
        ?>
><?php 
        _e('ASC', 'musik');
        ?>
</option>
        <option value="DESC" <?php 
        selected('DESC', $instance['order']);
        ?>
><?php 
        _e('DESC', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('display');
        ?>
"><?php 
        _e('Display:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('display'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('display'));
        ?>
">
        <option value="list" <?php 
        selected('list', $instance['display']);
        ?>
><?php 
        _e('List', 'musik');
        ?>
</option>
        <option value="grid" <?php 
        selected('grid', $instance['display']);
        ?>
><?php 
        _e('Grid', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('column');
        ?>
"><?php 
        _e('Grid Column:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('column'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('column'));
        ?>
">
        <option value="2" <?php 
        selected('2', $instance['column']);
        ?>
>2</option>
        <option value="3" <?php 
        selected('3', $instance['column']);
        ?>
>3</option>
        <option value="4" <?php 
        selected('4', $instance['column']);
        ?>
>4</option>
        <option value="6" <?php 
        selected('6', $instance['column']);
        ?>
>6</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('show_count');
        ?>
"><?php 
        _e('Show Count:', 'musik');
        ?>
</label>
      <input <?php 
        checked($instance['show_count'], 'on');
        ?>
 id="<?php 
        echo $this->get_field_id('show_count');
        ?>
" name="<?php 
        echo $this->get_field_name('show_count');
        ?>
" type="checkbox" />
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('include');
        ?>
"><?php 
        _e('Include:', 'musik');
        ?>
</label>
      <input type="text" id="<?php 
        echo $this->get_field_id('include');
        ?>
" name="<?php 
        echo $this->get_field_name('include');
        ?>
" value="<?php 
        echo $instance['include'];
        ?>
" />
      <small><em>Separate term ids with commas</em></small>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('hide_empty');
        ?>
"><?php 
        _e('Hide Empty Categories:', 'musik');
        ?>
</label>
      <input <?php 
        checked($instance['hide_empty'], 'on');
        ?>
 id="<?php 
        echo $this->get_field_id('hide_empty');
        ?>
" name="<?php 
        echo $this->get_field_name('hide_empty');
        ?>
" type="checkbox" />
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('count');
        ?>
"><?php 
        _e('Count:', 'musik');
        ?>
</label>
      <input type="text" id="<?php 
        echo $this->get_field_id('count');
        ?>
" name="<?php 
        echo $this->get_field_name('count');
        ?>
" value="<?php 
        echo $instance['count'];
        ?>
" />
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('pagination');
        ?>
"><?php 
        _e('Show Pagination:', 'musik');
        ?>
</label>
      <input <?php 
        checked($instance['pagination'], 'on');
        ?>
 id="<?php 
        echo $this->get_field_id('pagination');
        ?>
" name="<?php 
        echo $this->get_field_name('pagination');
        ?>
" type="checkbox" />
    </p>

    <?php 
    }
    /** @see WP_Widget::form */
    function form($instance)
    {
        // Set up some default widget settings.
        $defaults = array('title' => '', 'subtitle' => '', 'type' => 'all', 'orderby' => 'rand', 'order' => 'DESC', 'count' => 6, 'display' => 'Grid', 'column' => 4, 'pagination' => '', 'include' => '', 'filter' => '', 'filterid' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>

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

    <p>
      <label for="<?php 
        echo $this->get_field_id('subtitle');
        ?>
"><?php 
        _e('Sub Title:', 'musik');
        ?>
</label>
      <textarea class="widefat" id="<?php 
        echo $this->get_field_id('subtitle');
        ?>
" name="<?php 
        echo $this->get_field_name('subtitle');
        ?>
" ><?php 
        echo $instance['subtitle'];
        ?>
</textarea>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('type');
        ?>
"><?php 
        _e('Type:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('type'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('type'));
        ?>
">
        <option value="all" <?php 
        selected('all', $instance['type']);
        ?>
><?php 
        _e('All', 'musik');
        ?>
</option>
        <option value="single" <?php 
        selected('single', $instance['type']);
        ?>
><?php 
        _e('Single', 'musik');
        ?>
</option>
        <option value="bundle" <?php 
        selected('bundle', $instance['type']);
        ?>
><?php 
        _e('Bundle', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('orderby');
        ?>
"><?php 
        _e('Order by:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('orderby'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('orderby'));
        ?>
">
        <option value=""></option>
        <option value="rand" <?php 
        selected('rand', $instance['orderby']);
        ?>
><?php 
        _e('Random', 'musik');
        ?>
</option>
        <option value="id" <?php 
        selected('id', $instance['orderby']);
        ?>
><?php 
        _e('ID', 'musik');
        ?>
</option>
        <option value="name" <?php 
        selected('name', $instance['orderby']);
        ?>
><?php 
        _e('Name', 'musik');
        ?>
</option>
        <option value="date" <?php 
        selected('date', $instance['orderby']);
        ?>
><?php 
        _e('Date', 'musik');
        ?>
</option>
        <option value="meta_value_num" <?php 
        selected('meta_value_num', $instance['orderby']);
        ?>
><?php 
        _e('View', 'musik');
        ?>
</option>
        <option value="sales" <?php 
        selected('sales', $instance['orderby']);
        ?>
><?php 
        _e('Sales', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('order');
        ?>
"><?php 
        _e('Order:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('order'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('order'));
        ?>
">
        <option value="ASC" <?php 
        selected('ASC', $instance['order']);
        ?>
><?php 
        _e('ASC', 'musik');
        ?>
</option>
        <option value="DESC" <?php 
        selected('DESC', $instance['order']);
        ?>
><?php 
        _e('DESC', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('display');
        ?>
"><?php 
        _e('Display:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('display'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('display'));
        ?>
">
        <option value="list" <?php 
        selected('list', $instance['display']);
        ?>
><?php 
        _e('List', 'musik');
        ?>
</option>
        <option value="grid" <?php 
        selected('grid', $instance['display']);
        ?>
><?php 
        _e('Grid', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('column');
        ?>
"><?php 
        _e('Grid Column:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('column'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('column'));
        ?>
">
        <option value="2" <?php 
        selected('2', $instance['column']);
        ?>
>2</option>
        <option value="3" <?php 
        selected('3', $instance['column']);
        ?>
>3</option>
        <option value="4" <?php 
        selected('4', $instance['column']);
        ?>
>4</option>
        <option value="6" <?php 
        selected('6', $instance['column']);
        ?>
>6</option>
      </select>
    </p>

    <p>
      <label><?php 
        _e('Filter by:', 'musik');
        ?>
</label>
      <select name="<?php 
        echo esc_attr($this->get_field_name('filter'));
        ?>
" id="<?php 
        echo esc_attr($this->get_field_id('filter'));
        ?>
">
        <?php 
        $category_labels = function_exists('edd_get_taxonomy_labels') ? edd_get_taxonomy_labels('download_category') : 'Category';
        $tag_labels = function_exists('edd_get_taxonomy_labels') ? edd_get_taxonomy_labels('download_tag') : 'Tag';
        ?>
        <option value=""></option>
        <option value="download_category" <?php 
        selected('download_category', $instance['filter']);
        ?>
><?php 
        echo $category_labels['name'];
        ?>
</option>
        <option value="download_tag" <?php 
        selected('download_tag', $instance['filter']);
        ?>
><?php 
        echo $tag_labels['name'];
        ?>
</option>
        <option value="download_artist" <?php 
        selected('download_artist', $instance['filter']);
        ?>
><?php 
        echo __('Artist', 'musik');
        ?>
</option>
      </select>
    </p>

    <p>
      <label><?php 
        _e('Filter ids:', 'musik');
        ?>
</label>
      <input type="text" id="<?php 
        echo $this->get_field_id('filterid');
        ?>
" name="<?php 
        echo $this->get_field_name('filterid');
        ?>
" value="<?php 
        echo $instance['filterid'];
        ?>
" />
      <small><em>Separate taxonomy ids with commas</em></small>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('include');
        ?>
"><?php 
        _e('Include:', 'musik');
        ?>
</label>
      <input type="text" id="<?php 
        echo $this->get_field_id('include');
        ?>
" name="<?php 
        echo $this->get_field_name('include');
        ?>
" value="<?php 
        echo $instance['include'];
        ?>
" />
      <small><em>Separate music ids with commas</em></small>
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('count');
        ?>
"><?php 
        _e('Count:', 'musik');
        ?>
</label>
      <input type="text" id="<?php 
        echo $this->get_field_id('count');
        ?>
" name="<?php 
        echo $this->get_field_name('count');
        ?>
" value="<?php 
        echo $instance['count'];
        ?>
" />
    </p>

    <p>
      <label for="<?php 
        echo $this->get_field_id('pagination');
        ?>
"><?php 
        _e('Show Pagination:', 'musik');
        ?>
</label>
      <input <?php 
        checked($instance['pagination'], 'on');
        ?>
 id="<?php 
        echo $this->get_field_id('pagination');
        ?>
" name="<?php 
        echo $this->get_field_name('pagination');
        ?>
" type="checkbox" />
    </p>

    <?php 
    }