Passed
Pull Request — master (#794)
by Kiran
05:43
created
templates/payment-forms/elements/file_upload.php 1 patch
Switch Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * Displays a file_upload input in a payment form
4 4
  *
@@ -7,36 +7,36 @@  discard block
 block discarded – undo
7 7
  * @version 2.8.9
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+    defined( 'ABSPATH' ) || exit;
11 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();
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 21
 
22
-foreach ( $file_types as $file_type ) {
22
+    foreach ( $file_types as $file_type ) {
23 23
 
24
-	if ( isset( $all_types[ $file_type ] ) ) {
25
-		$types[]   = $all_types[ $file_type ];
26
-		$file_type = explode( '|', $file_type );
24
+	    if ( isset( $all_types[ $file_type ] ) ) {
25
+		    $types[]   = $all_types[ $file_type ];
26
+		    $file_type = explode( '|', $file_type );
27 27
 
28
-		foreach ( $file_type as $type ) {
29
-			$type     = trim( $type );
30
-			$types[]  = ".$type";
31
-			$_types[] = $type;
32
-		}
28
+		    foreach ( $file_type as $type ) {
29
+			    $type     = trim( $type );
30
+			    $types[]  = ".$type";
31
+			    $_types[] = $type;
32
+		    }
33 33
 }
34 34
 }
35 35
 
36
-if ( ! empty( $required ) ) {
37
-	$label .= "<span class='text-danger'> *</span>";
36
+    if ( ! empty( $required ) ) {
37
+	    $label .= "<span class='text-danger'> *</span>";
38 38
 }
39
-?>
39
+    ?>
40 40
 <label><span v-html="form_element.label"></span></label>
41 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 42
 	<label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label>
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 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 45
 		<div class="h5 text-dark">
46 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>
47
+    		</div>
48 48
 		<?php if ( ! empty( $description ) ) : ?>
49
-			<small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small>
49
+    			<small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small>
50 50
 		<?php endif; ?>
51 51
 	</label>
52 52
 	<div class="getpaid-uploaded-files"></div>
Please login to merge, or discard this patch.