Skip to content

Commit 24a3068

Browse files
Merge pull request #463 from Codeinwp/bugfix/pro/556
Fixed files download
2 parents f0a3fa7 + ffb015a commit 24a3068

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

inc/files.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ function ppom_create_thumb_for_meta( $file_name, $product_id, $cropped = false,
142142
* @return string The new file name.
143143
*/
144144
function ppom_create_unique_file_name( $file_name, $file_ext ) {
145-
return $file_name . "." . base64_encode( substr( wp_hash_password( $file_name ), 0, 8 ) ) . "." . $file_ext;
145+
$seed = $file_name . microtime( true ) . mt_rand();
146+
return $file_name . "." . wp_hash( $seed ) . "." . $file_ext;
146147
}
147148

148149
final class UploadFileErrors {

inc/functions.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,17 +1595,9 @@ function ppom_generate_html_for_files( $file_names, $input_type, $item ) {
15951595
$is_image_file = ppom_is_file_image( $file_path );
15961596
$ppom_file_thumb_url = $is_image_file ? $file_path : PPOM_URL . '/images/file.png';
15971597
$order_html .= '<tr><td class="ppom-files-display">';
1598-
1599-
if ( $is_image_file ) {
1600-
$order_html .= '<a target="_blank" href="' . esc_url( $ppom_file_url ) . '">';
1601-
}
1602-
1603-
$order_html .= '<img class="img-thumbnail" style="width:' . esc_attr( ppom_get_thumbs_size() ) . '" src="' . esc_url( $ppom_file_thumb_url ) . '">';
1604-
1605-
if ( $is_image_file ) {
1606-
$order_html .= '</a>';
1607-
}
1608-
1598+
$order_html .= '<a target="_blank" href="' . esc_url( $ppom_file_url ) . '">';
1599+
$order_html .= '<img class="img-thumbnail" style="width:' . esc_attr( ppom_get_thumbs_size() ) . '" src="' . esc_url( $ppom_file_thumb_url ) . '">';
1600+
$order_html .= '</a>';
16091601

16101602
// Requested by Kevin, hiding downloading file button after order on thank you page
16111603
// @since version 16.6

0 commit comments

Comments
 (0)