|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace HM\BackUpWordPress; |
|
4
|
|
|
|
|
5
|
|
|
$filesize = get_site_size_text( $schedule ); |
|
6
|
|
|
|
|
7
|
|
|
// Backup Type |
|
8
|
|
|
$type = strtolower( human_get_type( $schedule->get_type() ) ); |
|
9
|
|
|
|
|
10
|
|
|
// Backup Time |
|
11
|
|
|
$day = date_i18n( 'l', $schedule->get_next_occurrence( false ) ); |
|
12
|
|
|
|
|
13
|
|
|
// Next Backup |
|
14
|
|
|
$next_backup = 'title="' . esc_attr( sprintf( |
|
15
|
|
|
/* translators: 1: Date 2: Time 3: Timezone abbreviation. Eg., EST, MDT */ |
|
16
|
|
|
__( 'The next backup will be on %1$s at %2$s %3$s', 'backupwordpress' ), |
|
17
|
|
|
date_i18n( get_option( 'date_format' ), $schedule->get_next_occurrence( false ) ), |
|
18
|
|
|
date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ), |
|
19
|
|
|
date_i18n( 'T', $schedule->get_next_occurrence( false ) ) |
|
20
|
|
|
) ) . '"'; |
|
21
|
|
|
|
|
22
|
|
|
// Backup status |
|
23
|
|
|
$status = new Backup_Status( $schedule->get_id() ); |
|
24
|
|
|
|
|
25
|
|
|
// Backup Re-occurrence |
|
26
|
|
|
switch ( $schedule->get_reoccurrence() ) : |
|
27
|
|
|
|
|
28
|
|
|
case 'hourly' : |
|
29
|
|
|
|
|
30
|
|
|
$reoccurrence = date_i18n( 'i', $schedule->get_next_occurrence( false ) ) === '00' |
|
31
|
|
|
? '<span ' . $next_backup . '>' . esc_html__( 'hourly on the hour', 'backupwordpress' ) . '</span>' |
|
32
|
|
|
: sprintf( |
|
33
|
|
|
/* translators: Number of minutes */ |
|
34
|
|
|
esc_html__( 'hourly at %s minutes past the hour', 'backupwordpress' ), |
|
35
|
|
|
'<span ' . $next_backup . '>' . esc_html( intval( date_i18n( 'i', $schedule->get_next_occurrence( false ) ) ) ) . '</span>' |
|
36
|
|
|
); |
|
37
|
|
|
|
|
38
|
|
|
break; |
|
39
|
|
|
|
|
40
|
|
|
case 'daily' : |
|
41
|
|
|
|
|
42
|
|
|
$reoccurrence = sprintf( |
|
43
|
|
|
/* translators: Time */ |
|
44
|
|
|
esc_html__( 'daily at %s', 'backupwordpress' ), |
|
45
|
|
|
'<span ' . $next_backup . '>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
break; |
|
49
|
|
|
|
|
50
|
|
|
case 'twicedaily' : |
|
51
|
|
|
|
|
52
|
|
|
$times[] = date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ); |
|
53
|
|
|
$times[] = date_i18n( get_option( 'time_format' ), strtotime( '+ 12 hours', $schedule->get_next_occurrence( false ) ) ); |
|
54
|
|
|
|
|
55
|
|
|
sort( $times ); |
|
56
|
|
|
|
|
57
|
|
|
$reoccurrence = sprintf( |
|
58
|
|
|
/* translators: 1: First time the back up runs 2: Second time backup runs */ |
|
59
|
|
|
esc_html__( 'every 12 hours at %1$s & %2$s', 'backupwordpress' ), |
|
60
|
|
|
'<span ' . $next_backup . '>' . esc_html( reset( $times ) ) . '</span>', |
|
61
|
|
|
'<span>' . esc_html( end( $times ) ) . '</span>' |
|
62
|
|
|
); |
|
63
|
|
|
|
|
64
|
|
|
break; |
|
65
|
|
|
|
|
66
|
|
View Code Duplication |
case 'weekly' : |
|
67
|
|
|
|
|
68
|
|
|
$reoccurrence = sprintf( |
|
69
|
|
|
/* translators: 1: Full name of the week day, eg. Monday 2: Time */ |
|
70
|
|
|
esc_html__( 'weekly on %1$s at %2$s', 'backupwordpress' ), |
|
71
|
|
|
'<span ' . $next_backup . '>' . esc_html( $day ) . '</span>', |
|
72
|
|
|
'<span>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' |
|
73
|
|
|
); |
|
74
|
|
|
|
|
75
|
|
|
break; |
|
76
|
|
|
|
|
77
|
|
View Code Duplication |
case 'fortnightly' : |
|
78
|
|
|
|
|
79
|
|
|
$reoccurrence = sprintf( |
|
80
|
|
|
/* translators: 1: Full name of the week day, eg. Monday 2: Time */ |
|
81
|
|
|
esc_html__( 'every two weeks on %1$s at %2$s', 'backupwordpress' ), |
|
82
|
|
|
'<span ' . $next_backup . '>' . esc_html( $day ) . '</span>', |
|
83
|
|
|
'<span>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' |
|
84
|
|
|
); |
|
85
|
|
|
|
|
86
|
|
|
break; |
|
87
|
|
|
|
|
88
|
|
View Code Duplication |
case 'monthly' : |
|
89
|
|
|
|
|
90
|
|
|
$reoccurrence = sprintf( |
|
91
|
|
|
/* translators: 1: Ordinal number of a day of a month, eg. 1st, 10th 2: Time */ |
|
92
|
|
|
esc_html__( 'on the %1$s of each month at %2$s', 'backupwordpress' ), |
|
93
|
|
|
'<span ' . $next_backup . '>' . esc_html( date_i18n( 'jS', $schedule->get_next_occurrence( false ) ) ) . '</span>', |
|
94
|
|
|
'<span>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' |
|
95
|
|
|
); |
|
96
|
|
|
|
|
97
|
|
|
break; |
|
98
|
|
|
|
|
99
|
|
|
case 'manually' : |
|
100
|
|
|
|
|
101
|
|
|
$reoccurrence = esc_html__( 'manually', 'backupwordpress' ); |
|
102
|
|
|
|
|
103
|
|
|
break; |
|
104
|
|
|
|
|
105
|
|
|
default : |
|
106
|
|
|
|
|
107
|
|
|
$reoccurrence = esc_html__( 'manually', 'backupwordpress' ); |
|
108
|
|
|
$schedule->set_reoccurrence( 'manually' ); |
|
109
|
|
|
|
|
110
|
|
|
endswitch; |
|
111
|
|
|
|
|
112
|
|
|
$server = '<span title="' . esc_attr( Path::get_path() ) . '">' . esc_html__( 'this server', 'backupwordpress' ) . '</span>'; |
|
113
|
|
|
$server = '<code>' . esc_attr( str_replace( Path::get_home_path(), '', Path::get_path() ) ) . '</code>'; |
|
114
|
|
|
|
|
115
|
|
|
// Backup to keep |
|
116
|
|
|
switch ( $schedule->get_max_backups() ) : |
|
117
|
|
|
|
|
118
|
|
|
case 1 : |
|
119
|
|
|
|
|
120
|
|
|
$backup_to_keep = sprintf( esc_html__( 'store the most recent backup in %s', 'backupwordpress' ), $server ); |
|
121
|
|
|
|
|
122
|
|
|
break; |
|
123
|
|
|
|
|
124
|
|
|
case 0 : |
|
125
|
|
|
|
|
126
|
|
|
$backup_to_keep = sprintf( esc_html__( 'don\'t store any backups in on this server', 'backupwordpress' ), Path::get_path() ); |
|
127
|
|
|
|
|
128
|
|
|
break; |
|
129
|
|
|
|
|
130
|
|
|
default : |
|
131
|
|
|
|
|
132
|
|
|
$backup_to_keep = sprintf( |
|
133
|
|
|
/* translators: 1: The number of backups to store 2: Path on a server */ |
|
134
|
|
|
esc_html__( 'store the last %1$s backups in %2$s', 'backupwordpress' ), |
|
135
|
|
|
esc_html( $schedule->get_max_backups() ), |
|
136
|
|
|
$server |
|
137
|
|
|
); |
|
138
|
|
|
|
|
139
|
|
|
endswitch; |
|
140
|
|
|
|
|
141
|
|
|
$email_msg = ''; |
|
142
|
|
|
$services = array(); |
|
143
|
|
|
|
|
144
|
|
|
foreach ( Services::get_services( $schedule ) as $file => $service ) { |
|
145
|
|
|
|
|
146
|
|
|
if ( is_wp_error( $service ) ) { |
|
147
|
|
|
$email_msg = $service->get_error_message(); |
|
|
|
|
|
|
148
|
|
|
} elseif ( 'Email' === $service->name ) { |
|
149
|
|
|
$email_msg = wp_kses_post( $service->display() ); |
|
150
|
|
|
} elseif ( $service->is_service_active() && $service->display() ) { |
|
151
|
|
|
$services[] = esc_html( $service->display() ); |
|
152
|
|
|
} |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
if ( ! empty( $services ) && count( $services ) > 1 ) { |
|
156
|
|
|
$services[ count( $services ) -2 ] .= ' & ' . $services[ count( $services ) -1 ]; |
|
157
|
|
|
array_pop( $services ); |
|
158
|
|
|
} ?> |
|
159
|
|
|
|
|
160
|
|
|
<div class="hmbkp-schedule-sentence<?php if ( $status->get_status() ) { ?> hmbkp-running<?php } ?>"> |
|
161
|
|
|
|
|
162
|
|
|
<?php $sentence = sprintf( |
|
163
|
|
|
/* translators: 1: Backup Type (eg. complete, files, database, ...) 2: Total size of backup 3: Schedule (eg. hourly, daily, weekly, ...) 4: Number of backups to store */ |
|
164
|
|
|
esc_html__( 'Backup my %1$s %2$s %3$s, %4$s.', 'backupwordpress' ), |
|
165
|
|
|
'<span>' . esc_html( $type ) . '</span>', |
|
166
|
|
|
$filesize, |
|
167
|
|
|
$reoccurrence, |
|
168
|
|
|
$backup_to_keep |
|
169
|
|
|
); |
|
170
|
|
|
|
|
171
|
|
|
if ( $email_msg ) { |
|
172
|
|
|
$sentence .= ' ' . $email_msg; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
if ( $services ) { |
|
|
|
|
|
|
176
|
|
|
$sentence .= ' ' . sprintf( |
|
177
|
|
|
/* translators: List of available services for storing backups */ |
|
178
|
|
|
esc_html__( 'Send a copy of each backup to %s.', 'backupwordpress' ), |
|
179
|
|
|
implode( ', ', $services ) |
|
180
|
|
|
); |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
echo $sentence; ?> |
|
184
|
|
|
|
|
185
|
|
|
<?php if ( Schedules::get_instance()->get_schedule( $schedule->get_id() ) ) : |
|
186
|
|
|
schedule_status( $schedule ); |
|
187
|
|
|
endif; ?> |
|
188
|
|
|
|
|
189
|
|
|
<?php require( HMBKP_PLUGIN_PATH . 'admin/schedule-settings.php' ); ?> |
|
190
|
|
|
|
|
191
|
|
|
</div> |
|
192
|
|
|
|
|
193
|
|
|
<?php |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* Returns a formatted string containing the calculated total site size or a message |
|
197
|
|
|
* to indicate it is being calculated. |
|
198
|
|
|
* |
|
199
|
|
|
* @param HM\BackUpWordPress\Scheduled_Backup $schedule |
|
200
|
|
|
* |
|
201
|
|
|
* @return string |
|
202
|
|
|
*/ |
|
203
|
|
|
function get_site_size_text( Scheduled_Backup $schedule ) { |
|
204
|
|
|
|
|
205
|
|
|
if ( isset( $_GET['hmbkp_add_schedule'] ) ) { |
|
206
|
|
|
return ''; |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
$site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() ); |
|
210
|
|
|
|
|
211
|
|
|
if ( ( 'database' === $schedule->get_type() ) || $site_size->is_site_size_cached() ) { |
|
212
|
|
|
|
|
213
|
|
|
return sprintf( |
|
214
|
|
|
'(<code title="%1$s">%2$s</code>)', |
|
215
|
|
|
esc_attr__( 'Backups will be compressed and should be smaller than this.', 'backupwordpress' ), |
|
216
|
|
|
esc_html( $site_size->get_formatted_site_size() ) |
|
217
|
|
|
); |
|
218
|
|
|
|
|
219
|
|
|
} else { |
|
220
|
|
|
|
|
221
|
|
|
return sprintf( |
|
222
|
|
|
'(<code class="calculating" title="%1$s">%2$s</code>)', |
|
223
|
|
|
esc_attr__( 'this shouldn\'t take long…', 'backupwordpress' ), |
|
224
|
|
|
esc_html__( 'calculating the size of your site…', 'backupwordpress' ) |
|
225
|
|
|
); |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
} |
|
229
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.