class-destination-email.php
2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
*
*/
class BackWPup_Pro_Destination_Email extends BackWPup_Destination_Email {
/**
* @param $job_settings
*/
public function wizard_page( array $job_settings ) {
?>
<table class="form-table">
<tr>
<td>
<h3 class="title"><?php esc_html_e( 'Email address', 'backwpup' ); ?></h3>
<fieldset>
<label for="emailaddress"><strong><?php esc_html_e( 'Email address', 'backwpup' ); ?></strong><br/>
<input
name="emailaddress"
id="emailaddress"
type="text"
value="<?php echo esc_attr( $job_settings[ 'emailaddress' ] );?>"
class="regular-text"
/>
</label><br />
<label for="sendemailtest"><strong><?php esc_html_e( 'Send test email', 'backwpup' ); ?></strong><br/>
<button id="sendemailtest" class="button secondary"><?php esc_html_e( 'Send test email', 'backwpup' ); ?></button>
</label>
</fieldset>
</td>
</tr>
</table>
<?php
}
public function wizard_inline_js() {
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('#sendemailtest').live('click', function () {
$('#sendemailtest').after(' <img id="emailsendtext" src="<?php echo get_admin_url() . 'images/loading.gif'; ?>" width="16" height="16" />');
var data = {
action: 'backwpup_dest_email',
emailaddress: $('input[name="emailaddress"]').val(),
emailsndemail: '<?php echo esc_attr( get_bloginfo( 'admin_email' ) ); ?>',
_ajax_nonce: $('#backwpupajaxnonce').val()
};
$.post(ajaxurl, data, function (response) {
$('#emailsendtext').replaceWith(response);
});
return false;
});
});
</script>
<?php
}
/**
* @param $job_settings
*
* @return array
*/
public function wizard_save( array $job_settings ) {
$job_settings[ 'emailaddress' ] = isset( $_POST[ 'emailaddress' ] ) ? sanitize_email( $_POST[ 'emailaddress' ] ) : '';
$job_settings[ 'emailefilesize' ] = 25;
$job_settings[ 'emailsndemail' ] = get_bloginfo( 'admin_email' );
$job_settings[ 'emailsndemailname' ] = 'BackWPup ' . get_bloginfo( 'name' );
$job_settings[ 'emailmethod' ] = '';
return $job_settings;
}
}