function wpsc_product_download_forms() { global $post, $wpdb, $wpsc_product_defaults; $product_data = get_post_custom($post->ID); $output = ''; $product_data['meta'] = array(); if (!empty($product_data['_wpsc_product_metadata'])) { $product_data['meta'] = maybe_unserialize($product_data['_wpsc_product_metadata'][0]); } $upload_max = wpsc_get_max_upload_size(); ?> <?php echo wpsc_select_product_file($post->ID); ?> <a href="admin.php?wpsc_admin_action=product_files_existing&product_id=<?php echo absint($post->ID); ?> " class="thickbox button button-small" title="<?php echo esc_attr(sprintf(__('Select all downloadable files for %s', 'wp-e-commerce'), $post->post_title)); ?> "><?php esc_html_e('Add existing files...', 'wp-e-commerce'); ?> </a> <div class="wpsc_fileUpload button button-small"> <span><?php esc_html_e('Upload new file...', 'wp-e-commerce'); ?> </span> <input type='file' name='file' class="button button-small" value='' onchange="wpsc_push_v2t(this, '#wpsc_fileupload_path')" /> </div> <em id="wpsc_fileupload_path"></em> <?php if (function_exists("make_mp3_preview") || function_exists("wpsc_media_player")) { ?> <br /> <h4><?php esc_html_e('Select an MP3 file to upload as a preview', 'wp-e-commerce'); ?> </h4> <input type='file' name='preview_file' value='' /><br /> <h4><?php esc_html_e('Your preview for this product', 'wp-e-commerce'); ?> :</h4> <?php $args = array('post_type' => 'wpsc-preview-file', 'post_parent' => $post->ID, 'numberposts' => -1, 'post_status' => 'all'); $preview_files = (array) get_posts($args); foreach ($preview_files as $preview) { echo $preview->post_title . '<br />'; } ?> <br /> <?php } $output = apply_filters('wpsc_downloads_metabox', $output); }
function wpsc_product_download_forms($product_data = '') { global $wpdb, $closed_postboxes; if ($product_data == 'empty') { $display = "style='display:none;'"; } $output = ''; $upload_max = wpsc_get_max_upload_size(); $output .= "<div id='wpsc_product_download_forms' class='postbox " . (array_search('wpsc_product_download_forms', $product_data['closed_postboxes']) !== false ? 'closed' : '') . "' " . (array_search('wpsc_product_download_forms', $product_data['hidden_postboxes']) !== false ? 'style="display: none;"' : '') . ">"; $output .= "<h3 class='hndle'>" . TXT_WPSC_PRODUCTDOWNLOAD . "</h3>"; $output .= "<div class='inside'>"; $output .= "<h4>" . TXT_WPSC_DOWNLOADABLEPRODUCT . ":</h4>"; $output .= "<input type='file' name='file' value='' /><br />" . TXT_WPSC_MAX_UPLOAD_SIZE . " : <span>" . $upload_max . "</span><br /><br />"; $output .= wpsc_select_product_file($product_data['id']) . "<br />"; if ($product_data['file'] > 0) { $output .= TXT_WPSC_PREVIEW_FILE . ": "; $output .= "<a class='admin_download' href='index.php?admin_preview=true&product_id=" . $product_data['id'] . "' ><img align='absmiddle' src='" . WPSC_URL . "/images/download.gif' alt='' title='' /><span>" . TXT_WPSC_CLICKTODOWNLOAD . "</span></a>"; $file_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id`='" . $product_data['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null && function_exists('listen_button')) { $output .= "" . listen_button($file_data['idhash'], $file_data['id']) . "<br style='clear: both;' /><br />"; } } if (function_exists("make_mp3_preview") || function_exists("wpsc_media_player")) { $output .= "<h4>" . __("Select an MP3 file to upload as a preview") . "</h4>"; $output .= "<input type='file' name='preview_file' value='' /><br />"; $output .= "<br />"; } $output .= "</div></div>"; return $output; }
function wpsc_product_download_forms() { global $post, $wpdb, $wpsc_product_defaults; $product_data = get_post_custom($post->ID); $output = ''; $product_data['meta'] = $product_meta = array(); if (!empty($product_data['_wpsc_product_metadata'])) { $product_data['meta'] = $product_meta = maybe_unserialize($product_data['_wpsc_product_metadata'][0]); } $upload_max = wpsc_get_max_upload_size(); ?> <?php echo wpsc_select_product_file($post->ID); ?> <h4><a href="admin.php?wpsc_admin_action=product_files_existing&product_id=<?php echo $post->ID; ?> " class="thickbox" title="<?php echo esc_attr(sprintf(__('Select all downloadable files for %s', 'wpsc'), $post->post_title)); ?> "><?php esc_html_e('Select from existing files', 'wpsc'); ?> </a></h4> <a name="wpsc_downloads"></a> <h4><?php esc_html_e('Upload New File', 'wpsc'); ?> :</h4> <input type='file' name='file' value='' /><br /><?php esc_html_e('Max Upload Size ', 'wpsc'); ?> :<span><?php echo $upload_max; ?> </span><span><?php esc_html_e(' - Choose your file, then update this product to save the download.', 'wpsc'); ?> </span><br /><br /> <?php if (function_exists("make_mp3_preview") || function_exists("wpsc_media_player")) { ?> <br /> <h4><?php esc_html_e('Select an MP3 file to upload as a preview', 'wpsc'); ?> </h4> <input type='file' name='preview_file' value='' /><br /> <h4><?php esc_html_e('Your preview for this product', 'wpsc'); ?> :</h4> <?php $args = array('post_type' => 'wpsc-preview-file', 'post_parent' => $post->ID, 'numberposts' => -1, 'post_status' => 'all'); $preview_files = (array) get_posts($args); foreach ($preview_files as $preview) { echo $preview->post_title . '<br />'; } ?> <br /> <?php } $output = apply_filters('wpsc_downloads_metabox', $output); }