|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Displays a file_upload input in a payment form |
|
4
|
|
|
* |
|
5
|
|
|
* This template can be overridden by copying it to yourtheme/invoicing/payment-forms/elements/file_upload.php. |
|
6
|
|
|
* |
|
7
|
|
|
* @version 2.8.9 |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
defined( 'ABSPATH' ) || exit; |
|
11
|
|
|
|
|
12
|
|
|
$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13
|
|
|
$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
14
|
|
|
$id = esc_attr( $id ); |
|
15
|
|
|
$_id = $id . uniqid( '_' ); |
|
16
|
|
|
$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num ); |
|
17
|
|
|
$file_types = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types; |
|
18
|
|
|
$all_types = getpaid_get_allowed_mime_types(); |
|
19
|
|
|
$types = array(); |
|
20
|
|
|
$_types = array(); |
|
21
|
|
|
|
|
22
|
|
|
foreach ( $file_types as $file_type ) { |
|
23
|
|
|
|
|
24
|
|
|
if ( isset( $all_types[ $file_type ] ) ) { |
|
25
|
|
|
$types[] = $all_types[ $file_type ]; |
|
26
|
|
|
$file_type = explode( '|', $file_type ); |
|
27
|
|
|
|
|
28
|
|
|
foreach ( $file_type as $type ) { |
|
29
|
|
|
$type = trim( $type ); |
|
30
|
|
|
$types[] = ".$type"; |
|
31
|
|
|
$_types[] = $type; |
|
32
|
|
|
} |
|
33
|
|
|
} |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
if ( ! empty( $required ) ) { |
|
37
|
|
|
$label .= "<span class='text-danger'> *</span>"; |
|
38
|
|
|
} |
|
39
|
|
|
?> |
|
40
|
|
|
<label><span v-html="form_element.label"></span></label> |
|
41
|
|
|
<div class="form-group mb-3 <?php echo esc_attr( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>"> |
|
42
|
|
|
<label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label> |
|
43
|
|
|
<input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
|
|
|
|
|
44
|
|
|
<label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
45
|
|
|
<div class="h5 text-dark"> |
|
46
|
|
|
<?php echo esc_html( ( $max_file_num > 1 ? __( 'Drag files to this area or click to upload', 'invoicing' ) : __( 'Drag your file to this area or click to upload', 'invoicing' ) ) ); ?> |
|
47
|
|
|
</div> |
|
48
|
|
|
<?php if ( ! empty( $description ) ) : ?> |
|
49
|
|
|
<small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small> |
|
50
|
|
|
<?php endif; ?> |
|
51
|
|
|
</label> |
|
52
|
|
|
<div class="getpaid-uploaded-files"></div> |
|
53
|
|
|
<div class="form-row row mb-3 d-none getpaid-progress-template"> |
|
54
|
|
|
<div class="overflow-hidden text-nowrap col-7 col-sm-4"> |
|
55
|
|
|
<a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">×<span class="sr-only"><?php esc_html_e( 'Close', 'invoicing' ); ?></span></a> |
|
56
|
|
|
<i class="fa fa-file" aria-hidden="true"></i> <span class="getpaid-progress-file-name"></span> |
|
57
|
|
|
</div> |
|
58
|
|
|
<div class="col-5 col-sm-8 getpaid-progress"> |
|
59
|
|
|
<div class="progress" style="height: 40px"> |
|
60
|
|
|
<div class="progress-bar" role="progressbar" style="width: 0" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div> |
|
61
|
|
|
</div> |
|
62
|
|
|
</div> |
|
63
|
|
|
</div> |
|
64
|
|
|
</div> |
|
65
|
|
|
|