| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $aui_bs5; |
| 7 |
|
| 8 |
$files = new UsersWP_Files(); |
| 9 |
$type = isset( $_POST['type'] ) && $_POST['type'] == 'avatar' ? 'avatar' : 'banner'; |
| 10 |
?> |
| 11 |
<div class="modal-header" xmlns="http://www.w3.org/1999/html"> |
| 12 |
<h5 class="modal-title" id="uwp-profile-modal-title"> |
| 13 |
<?php |
| 14 |
if ( $type == 'avatar' ) { |
| 15 |
esc_html_e( 'Change your profile photo', 'userswp' ); |
| 16 |
$label = __( "Upload Avatar", "userswp" ); |
| 17 |
} else { |
| 18 |
esc_html_e( 'Change your cover photo', 'userswp' ); |
| 19 |
$label = __( "Upload Banner", "userswp" ); |
| 20 |
} |
| 21 |
?> |
| 22 |
</h5> |
| 23 |
</div> |
| 24 |
<div class="modal-body text-center"> |
| 25 |
<div id="uwp-bs-modal-notice"></div> |
| 26 |
<form id="uwp-upload-<?php echo esc_attr( $type ); ?>-form" method="post" enctype="multipart/form-data"> |
| 27 |
<?php |
| 28 |
echo aui()->input(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 29 |
'type' => 'hidden', |
| 30 |
'name' => 'uwp_upload_nonce', |
| 31 |
'no_wrap' => true, |
| 32 |
'value' => esc_html( wp_create_nonce( 'uwp-upload-nonce' ) ), |
| 33 |
)); |
| 34 |
echo aui()->input(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 35 |
'type' => 'hidden', |
| 36 |
'name' => esc_html( 'uwp_'.$type.'_submit' ), |
| 37 |
'no_wrap' => true, |
| 38 |
'value' => '', |
| 39 |
)); |
| 40 |
echo aui()->button(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 41 |
'type' => 'button', |
| 42 |
'class' => 'btn btn-primary uwp_upload_button', |
| 43 |
'content' => '<i class="fas fa-upload"></i>'. esc_html( $label ), |
| 44 |
'onclick' => "document.getElementById('uwp_upload_".esc_js( $type )."').click();", |
| 45 |
)); |
| 46 |
echo aui()->alert( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 47 |
'class' => 'text-center text-center m-3 p-0 w-50 mx-auto', |
| 48 |
'type' => 'info', |
| 49 |
'content' => esc_html( sprintf( __( 'Note: Max upload image size: %s', 'userswp' ), $files->uwp_formatSizeUnits( $files->uwp_get_max_upload_size( $type ) ) ) ) |
| 50 |
) |
| 51 |
); |
| 52 |
?> |
| 53 |
<div class="uwp_upload_field d-none"> |
| 54 |
<?php |
| 55 |
echo aui()->input(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 56 |
'type' => 'file', |
| 57 |
'id' => esc_html( 'uwp_upload_'.$type ), |
| 58 |
'name' => esc_html( 'uwp_'.$type.'_file' ), |
| 59 |
'extra_attributes' => array('required'=>'required') |
| 60 |
)); |
| 61 |
?> |
| 62 |
</div> |
| 63 |
</form> |
| 64 |
<div id="progressBar" class="progress progressBar d-none"> |
| 65 |
<div class="progress-bar bg-success w-0" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> |
| 66 |
</div> |
| 67 |
</div> |
| 68 |
|
| 69 |
<div class="modal-footer"> |
| 70 |
<?php |
| 71 |
echo aui()->button(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 72 |
'type' => 'button', |
| 73 |
'class' => 'btn btn-outline-primary uwp_modal_btn uwp-modal-close', |
| 74 |
'content' => esc_html__( 'Cancel', 'userswp' ), |
| 75 |
'extra_attributes' => array('data-type'=> esc_html( $type ), 'data-' . ( $aui_bs5 ? 'bs-' : '' ) . 'dismiss'=>"modal") |
| 76 |
)); |
| 77 |
?> |
| 78 |
<div class="uwp-<?php echo esc_attr( $type ); ?>-crop-p-wrap"> |
| 79 |
<div id="<?php echo esc_attr( $type ); ?>-crop-actions"> |
| 80 |
<form class="uwp-crop-form" method="post"> |
| 81 |
<?php |
| 82 |
echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 83 |
'type' => 'hidden', |
| 84 |
'name' => 'uwp_reset_nonce', |
| 85 |
'id' => 'uwp_reset_nonce', |
| 86 |
'value' => esc_html( wp_create_nonce( 'uwp_reset_nonce_' . $type . '_' . $user_id ) ), |
| 87 |
'no_wrap' => true, |
| 88 |
) ); |
| 89 |
echo aui()->button(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 90 |
'type' => 'submit', |
| 91 |
'id' => esc_html( 'reset_uwp_'.$type ), |
| 92 |
'name' => esc_html( 'uwp_'.$type.'_reset' ), |
| 93 |
'class' => 'btn btn-primary btn-danger', |
| 94 |
'content' => esc_html__( 'Reset to Default', 'userswp' ), |
| 95 |
)); |
| 96 |
echo aui()->button(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 97 |
'type' => 'submit', |
| 98 |
'id' => esc_html( 'save_uwp_'.$type ), |
| 99 |
'name' => esc_html( 'uwp_'.$type.'_crop' ), |
| 100 |
'class' => 'btn btn-primary', |
| 101 |
'content' => esc_html__( 'Apply', 'userswp' ), |
| 102 |
'extra_attributes' => array('disabled'=>'disabled') |
| 103 |
)); |
| 104 |
?> |
| 105 |
</form> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
</div> |