Version Description
- Bug fixed related to security issues
Download this release
Release Info
Developer | BackupGuard |
Plugin | WordPress Backup and Migrate Plugin – Backup Guard |
Version | 1.6.9.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.9 to 1.6.9.1
- BackupGuard.php +1146 -1144
- README.txt +4 -1
- backup.php +36 -36
- public/backups.php +2 -2
- public/js/sgschedule.js +251 -251
- public/js/sgsettings.js +33 -38
- public/settings.php +341 -340
BackupGuard.php
CHANGED
@@ -1,1144 +1,1146 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// hook to wordpres widget
|
4 |
-
function backup_guard_register_widget()
|
5 |
-
{
|
6 |
-
if (!class_exists('SGWordPressWidget')) {
|
7 |
-
@include_once SG_WIDGET_PATH . 'SGWordPressWidget.php';
|
8 |
-
}
|
9 |
-
|
10 |
-
register_widget('SGWordPressWidget');
|
11 |
-
}
|
12 |
-
|
13 |
-
add_action('widgets_init', 'backup_guard_register_widget');
|
14 |
-
|
15 |
-
//The code that runs during plugin activation.
|
16 |
-
function activate_backup_guard()
|
17 |
-
{
|
18 |
-
//check if database should be updated
|
19 |
-
if (backupGuardShouldUpdate()) {
|
20 |
-
SGBoot::install();
|
21 |
-
SGBoot::didInstallForFirstTime();
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
// The code that runs during plugin deactivation.
|
26 |
-
function uninstall_backup_guard()
|
27 |
-
{
|
28 |
-
SGBoot::uninstall();
|
29 |
-
}
|
30 |
-
|
31 |
-
function deactivate_backup_guard()
|
32 |
-
{
|
33 |
-
$pluginCapabilities = backupGuardGetCapabilities();
|
34 |
-
if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
|
35 |
-
include_once SG_LIB_PATH . 'SGAuthClient.php';
|
36 |
-
SGAuthClient::getInstance()->logout();
|
37 |
-
SGConfig::set('SG_LICENSE_CHECK_TS', 0, true);
|
38 |
-
SGConfig::set('SG_LOGGED_USER', '', true);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
function backupGuardMaybeShortenEddFilename($return, $package)
|
43 |
-
{
|
44 |
-
if (strpos($package, 'backup-guard') !== false) {
|
45 |
-
add_filter('wp_unique_filename', 'backupGuardShortenEddFilename', 10, 2);
|
46 |
-
}
|
47 |
-
return $return;
|
48 |
-
}
|
49 |
-
|
50 |
-
function backupGuardShortenEddFilename($filename, $ext)
|
51 |
-
{
|
52 |
-
$filename = substr($filename, 0, 20) . $ext;
|
53 |
-
remove_filter('wp_unique_filename', 'backupGuardShortenEddFilename', 10);
|
54 |
-
return $filename;
|
55 |
-
}
|
56 |
-
|
57 |
-
add_filter('upgrader_pre_download', 'backupGuardMaybeShortenEddFilename', 10, 4);
|
58 |
-
|
59 |
-
register_activation_hook(SG_BACKUP_GUARD_MAIN_FILE, 'activate_backup_guard');
|
60 |
-
register_uninstall_hook(SG_BACKUP_GUARD_MAIN_FILE, 'uninstall_backup_guard');
|
61 |
-
register_deactivation_hook(SG_BACKUP_GUARD_MAIN_FILE, 'deactivate_backup_guard');
|
62 |
-
//add_action('admin_footer', 'before_deactivate_backup_guard');
|
63 |
-
|
64 |
-
function before_deactivate_backup_guard()
|
65 |
-
{
|
66 |
-
wp_enqueue_style('before-deactivate-backup-guard-css', plugin_dir_url(__FILE__) . 'public/css/deactivationSurvey.css');
|
67 |
-
wp_enqueue_script('before-deactivate-backup-guard-js', plugin_dir_url(__FILE__) . 'public/js/deactivationSurvey.js', array('jquery'));
|
68 |
-
|
69 |
-
wp_localize_script(
|
70 |
-
'before-deactivate-backup-guard-js',
|
71 |
-
'BG_BACKUP_STRINGS_DEACTIVATE',
|
72 |
-
array('nonce' => wp_create_nonce('backupGuardAjaxNonce'),
|
73 |
-
'areYouSure' => _backupGuardT('Are you sure?', true),
|
74 |
-
'invalidCloud' => _backupGuardT('Please select at least 1 cloud', true)
|
75 |
-
)
|
76 |
-
);
|
77 |
-
|
78 |
-
include_once plugin_dir_path(__FILE__) . 'public/include/uninstallSurveyPopup.php';
|
79 |
-
}
|
80 |
-
|
81 |
-
// Register Admin Menus for single and multisite
|
82 |
-
if (is_multisite()) {
|
83 |
-
add_action('network_admin_menu', 'backup_guard_admin_menu');
|
84 |
-
} else {
|
85 |
-
add_action('admin_menu', 'backup_guard_admin_menu');
|
86 |
-
}
|
87 |
-
|
88 |
-
function backup_guard_admin_menu()
|
89 |
-
{
|
90 |
-
$capability = 'manage_options';
|
91 |
-
if (defined('SG_USER_MODE') && SG_USER_MODE) {
|
92 |
-
$capability = 'read';
|
93 |
-
}
|
94 |
-
|
95 |
-
add_menu_page('Backups', 'BackupGuard', $capability, 'backup_guard_backups', 'includeAllPages', 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MzAuMzQgNjYzLjAzIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkFydGJvYXJkIDI8L3RpdGxlPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTUzMC4xMSwxODUuNzljLTcxLjktOC44Mi0xMzcuNzMtNDAtMTkwLTg2LjU3djkyLjY1YTI4MC41OSwyODAuNTksMCwwLDAsMTE2LjUyLDUyYy05LjE0LDg5LjQzLTUyLDE2OS41NS0xMTYuNTIsMjI4Ljg3djkwLjRDNDU5Ljg0LDQ3Ny4xMyw1MzAuNiwzMzMuNDIsNTMwLjExLDE4NS43OVoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNzQuMjksMjQ0YTI4MC40NiwyODAuNDYsMCwwLDAsMTE1Ljc3LTUxLjExVjEwMGMtNTIuNDQsNDYuMjgtMTE3LjYyLDc3LTE4OS44Myw4NS4xNUM5OS41NCwzMzMsMTcwLjIyLDQ3Ni44MiwyOTAuMDYsNTYzVjQ3Mi4wOUMyMjYsNDEyLjg2LDE4My40MiwzMzMuMDYsMTc0LjI5LDI0NFoiLz48L3N2Zz4=', 74);
|
96 |
-
|
97 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Backups', true), _backupGuardT('Backups', true), $capability, 'backup_guard_backups', 'includeAllPages');
|
98 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Cloud', true), _backupGuardT('Cloud', true), $capability, 'backup_guard_cloud', 'includeAllPages');
|
99 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Schedule', true), _backupGuardT('Schedule', true), $capability, 'backup_guard_schedule', 'includeAllPages');
|
100 |
-
|
101 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Settings', true), _backupGuardT('Settings', true), $capability, 'backup_guard_settings', 'includeAllPages');
|
102 |
-
|
103 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('System Info.', true), _backupGuardT('System Info.', true), $capability, 'backup_guard_system_info', 'includeAllPages');
|
104 |
-
|
105 |
-
//add_submenu_page('backup_guard_backups', _backupGuardT('Services', true), _backupGuardT('Services', true), $capability, 'backup_guard_services', 'includeAllPages');
|
106 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Video Tutorials', true), _backupGuardT('Video Tutorials', true), $capability, 'backup_guard_videoTutorials', 'includeAllPages');
|
107 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Support', true), _backupGuardT('Support', true), $capability, 'backup_guard_support', 'includeAllPages');
|
108 |
-
|
109 |
-
//Check if should show upgrade page
|
110 |
-
if (SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE')) {
|
111 |
-
add_submenu_page('backup_guard_backups', _backupGuardT('Why upgrade?', true), _backupGuardT('Why upgrade?', true), $capability, 'backup_guard_pro_features', 'includeAllPages');
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
function getBackupPageContentClassName($pageName = '')
|
116 |
-
{
|
117 |
-
$hiddenClassName = 'sg-visibility-hidden';
|
118 |
-
$page = $_GET['page'];
|
119 |
-
|
120 |
-
if (strpos($page, $pageName)) {
|
121 |
-
$hiddenClassName = '';
|
122 |
-
}
|
123 |
-
|
124 |
-
return $hiddenClassName;
|
125 |
-
}
|
126 |
-
|
127 |
-
function includeAllPages()
|
128 |
-
{
|
129 |
-
if (!backupGuardValidateLicense()) {
|
130 |
-
return false;
|
131 |
-
}
|
132 |
-
backup_guard_backups_page();
|
133 |
-
backup_guard_cloud_page();
|
134 |
-
backup_guard_system_info_page();
|
135 |
-
backup_guard_services_page();
|
136 |
-
backup_guard_pro_features_page();
|
137 |
-
backup_guard_support_page();
|
138 |
-
backup_guard_schedule_page();
|
139 |
-
backup_guard_settings_page();
|
140 |
-
|
141 |
-
include_once plugin_dir_path(__FILE__) . 'public/pagesContent.php';
|
142 |
-
|
143 |
-
return true;
|
144 |
-
}
|
145 |
-
|
146 |
-
function backup_guard_system_info_page()
|
147 |
-
{
|
148 |
-
if (backupGuardValidateLicense()) {
|
149 |
-
//require_once(plugin_dir_path(__FILE__).'public/systemInfo.php');
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
function backup_guard_services_page()
|
154 |
-
{
|
155 |
-
if (backupGuardValidateLicense()) {
|
156 |
-
//require_once(plugin_dir_path(__FILE__).'public/services.php');
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
//Pro features page
|
161 |
-
function backup_guard_pro_features_page()
|
162 |
-
{
|
163 |
-
// require_once(plugin_dir_path(__FILE__).'public/proFeatures.php');
|
164 |
-
}
|
165 |
-
|
166 |
-
function backup_guard_security_page()
|
167 |
-
{
|
168 |
-
include_once plugin_dir_path(__FILE__) . 'public/security.php';
|
169 |
-
}
|
170 |
-
|
171 |
-
//Support page
|
172 |
-
function backup_guard_support_page()
|
173 |
-
{
|
174 |
-
if (backupGuardValidateLicense()) {
|
175 |
-
// require_once(plugin_dir_path(__FILE__).'public/support.php');
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
//Backups Page
|
180 |
-
function backup_guard_backups_page()
|
181 |
-
{
|
182 |
-
if (backupGuardValidateLicense()) {
|
183 |
-
wp_enqueue_script('backup-guard-iframe-transport-js', plugin_dir_url(__FILE__) . 'public/js/jquery.iframe-transport.js', array('jquery'));
|
184 |
-
wp_enqueue_script('backup-guard-fileupload-js', plugin_dir_url(__FILE__) . 'public/js/jquery.fileupload.js', array('jquery'));
|
185 |
-
wp_enqueue_script('backup-guard-jstree-js', plugin_dir_url(__FILE__) . 'public/js/jstree.min.js', array('jquery'));
|
186 |
-
wp_enqueue_script('backup-guard-jstree-checkbox-js', plugin_dir_url(__FILE__) . 'public/js/jstree.checkbox.js', array('jquery'));
|
187 |
-
wp_enqueue_script('backup-guard-jstree-wholerow-js', plugin_dir_url(__FILE__) . 'public/js/jstree.wholerow.js', array('jquery'));
|
188 |
-
wp_enqueue_script('backup-guard-jstree-types-js', plugin_dir_url(__FILE__) . 'public/js/jstree.types.js', array('jquery'));
|
189 |
-
wp_enqueue_style('backup-guard-jstree-css', plugin_dir_url(__FILE__) . 'public/css/default/style.min.css');
|
190 |
-
wp_enqueue_script('backup-guard-backups-js', plugin_dir_url(__FILE__) . 'public/js/sgbackup.js', array('jquery',
|
191 |
-
'jquery-effects-core', 'jquery-effects-transfer', 'jquery-ui-widget'));
|
192 |
-
|
193 |
-
// Localize the script with new data
|
194 |
-
wp_localize_script(
|
195 |
-
'backup-guard-backups-js',
|
196 |
-
'BG_BACKUP_STRINGS',
|
197 |
-
array(
|
198 |
-
'confirm' => _backupGuardT('Are you sure you want to cancel import?', true),
|
199 |
-
'nonce' => wp_create_nonce('backupGuardAjaxNonce'),
|
200 |
-
'invalidBackupOption' => _backupGuardT('Please choose at least one option.', true),
|
201 |
-
'invalidDirectorySelected' => _backupGuardT('Please choose at least one directory.', true),
|
202 |
-
'invalidCloud' => _backupGuardT('Please choose at least one cloud.', true),
|
203 |
-
'backupInProgress' => _backupGuardT('Backing Up...', true),
|
204 |
-
'errorMessage' => _backupGuardT('Something went wrong. Please try again.', true),
|
205 |
-
'noBackupsAvailable' => _backupGuardT('No backups found.', true),
|
206 |
-
'invalidImportOption' => _backupGuardT('Please select one of the options.', true),
|
207 |
-
'invalidDownloadFile' => _backupGuardT('Please choose one of the files.', true),
|
208 |
-
'import' => _backupGuardT('Import', true),
|
209 |
-
'importInProgress' => _backupGuardT('Importing please wait...', true),
|
210 |
-
'fileUploadFailed' => _backupGuardT('File upload failed.', true)
|
211 |
-
)
|
212 |
-
);
|
213 |
-
|
214 |
-
// require_once(plugin_dir_path( __FILE__ ).'public/backups.php');
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
//Cloud Page
|
219 |
-
function backup_guard_cloud_page()
|
220 |
-
{
|
221 |
-
if (backupGuardValidateLicense()) {
|
222 |
-
wp_enqueue_style('backup-guard-switch-css', plugin_dir_url(__FILE__) . 'public/css/bootstrap-switch.min.css');
|
223 |
-
wp_enqueue_script('backup-guard-switch-js', plugin_dir_url(__FILE__) . 'public/js/bootstrap-switch.min.js', array('jquery'), SG_BACKUP_GUARD_VERSION, true);
|
224 |
-
wp_enqueue_script('backup-guard-jquery-validate-js', plugin_dir_url(__FILE__) . 'public/js/jquery.validate.min.js', array('jquery',
|
225 |
-
'backup-guard-switch-js'), SG_BACKUP_GUARD_VERSION, true);
|
226 |
-
wp_enqueue_script('backup-guard-cloud-js', plugin_dir_url(__FILE__) . 'public/js/sgcloud.js', array('jquery',
|
227 |
-
'backup-guard-switch-js'), SG_BACKUP_GUARD_VERSION, true);
|
228 |
-
|
229 |
-
// Localize the script with new data
|
230 |
-
wp_localize_script(
|
231 |
-
'backup-guard-cloud-js',
|
232 |
-
'BG_CLOUD_STRINGS',
|
233 |
-
array(
|
234 |
-
'invalidImportFile' => _backupGuardT('Please select a file.', true),
|
235 |
-
'invalidFileSize' => _backupGuardT('File is too large.', true),
|
236 |
-
'connectionInProgress' => _backupGuardT('Connecting...', true),
|
237 |
-
'invalidDestinationFolder' => _backupGuardT('Destination folder is required.', true),
|
238 |
-
'invalidDestinationFolderName' => _backupGuardT('Destination folder: type only letters, numbers and ""―".', true),
|
239 |
-
'successMessage' => _backupGuardT('Successfully saved.', true)
|
240 |
-
)
|
241 |
-
);
|
242 |
-
|
243 |
-
//require_once(plugin_dir_path(__FILE__).'public/cloud.php');
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
//Schedule Page
|
248 |
-
function backup_guard_schedule_page()
|
249 |
-
{
|
250 |
-
if (backupGuardValidateLicense()) {
|
251 |
-
wp_enqueue_style('backup-guard-switch-css', plugin_dir_url(__FILE__) . 'public/css/bootstrap-switch.min.css');
|
252 |
-
wp_enqueue_script('backup-guard-switch-js', plugin_dir_url(__FILE__) . 'public/js/bootstrap-switch.min.js', array('jquery'), '1.0.0', true);
|
253 |
-
wp_enqueue_script('backup-guard-schedule-js', plugin_dir_url(__FILE__) . 'public/js/sgschedule.js', array('jquery'), '1.0.0', true);
|
254 |
-
|
255 |
-
// Localize the script with new data
|
256 |
-
wp_localize_script(
|
257 |
-
'backup-guard-schedule-js',
|
258 |
-
'BG_SCHEDULE_STRINGS',
|
259 |
-
array(
|
260 |
-
'deletionError' => _backupGuardT('Unable to delete schedule', true),
|
261 |
-
'confirm' => _backupGuardT('Are you sure?', true),
|
262 |
-
'invalidBackupOption' => _backupGuardT('Please choose at least one option.', true),
|
263 |
-
'invalidDirectorySelected' => _backupGuardT('Please choose at least one directory.', true),
|
264 |
-
'invalidCloud' => _backupGuardT('Please choose at least one cloud.', true),
|
265 |
-
'savingInProgress' => _backupGuardT('Saving...', true),
|
266 |
-
'successMessage' => _backupGuardT('You have successfully activated schedule.', true),
|
267 |
-
'saveButtonText' => _backupGuardT('Save', true)
|
268 |
-
)
|
269 |
-
);
|
270 |
-
|
271 |
-
// require_once(plugin_dir_path( __FILE__ ).'public/schedule.php');
|
272 |
-
}
|
273 |
-
}
|
274 |
-
|
275 |
-
//Settings Page
|
276 |
-
function backup_guard_settings_page()
|
277 |
-
{
|
278 |
-
if (backupGuardValidateLicense()) {
|
279 |
-
wp_enqueue_style('backup-guard-switch-css', plugin_dir_url(__FILE__) . 'public/css/bootstrap-switch.min.css');
|
280 |
-
wp_enqueue_script('backup-guard-switch-js', plugin_dir_url(__FILE__) . 'public/js/bootstrap-switch.min.js', array('jquery'), '1.0.0', true);
|
281 |
-
wp_enqueue_script('backup-guard-settings-js', plugin_dir_url(__FILE__) . 'public/js/sgsettings.js', array('jquery'), '1.0.0', true);
|
282 |
-
|
283 |
-
// Localize the script with new data
|
284 |
-
wp_localize_script(
|
285 |
-
'backup-guard-settings-js',
|
286 |
-
'BG_SETTINGS_STRINGS',
|
287 |
-
array(
|
288 |
-
'invalidEmailAddress' => _backupGuardT('Please enter valid email.', true),
|
289 |
-
'invalidFileName' => _backupGuardT('Please enter valid file name.', true),
|
290 |
-
'invalidRetentionNumber' => _backupGuardT('Please enter a valid retention number.', true),
|
291 |
-
'successMessage' => _backupGuardT('Successfully saved.', true),
|
292 |
-
'savingInProgress' => _backupGuardT('Saving...', true),
|
293 |
-
'retentionConfirmationFirstPart' => _backupGuardT('Are you sure you want to keep the latest', true),
|
294 |
-
'retentionConfirmationSecondPart' => _backupGuardT('backups? All older backups will be deleted.', true),
|
295 |
-
'saveButtonText' => _backupGuardT('Save', true)
|
296 |
-
)
|
297 |
-
);
|
298 |
-
|
299 |
-
//require_once(plugin_dir_path(__FILE__).'public/settings.php');
|
300 |
-
}
|
301 |
-
}
|
302 |
-
|
303 |
-
function backup_guard_login_page()
|
304 |
-
{
|
305 |
-
wp_enqueue_script('backup-guard-login-js', plugin_dir_url(__FILE__) . 'public/js/sglogin.js', array('jquery'), '1.0.0', true);
|
306 |
-
|
307 |
-
include_once plugin_dir_path(__FILE__) . 'public/login.php';
|
308 |
-
}
|
309 |
-
|
310 |
-
function backup_guard_link_license_page()
|
311 |
-
{
|
312 |
-
wp_enqueue_script('backup-guard-license-js', plugin_dir_url(__FILE__) . 'public/js/sglicense.js', array('jquery'), '1.0.0', true);
|
313 |
-
// Localize the script with new data
|
314 |
-
wp_localize_script(
|
315 |
-
'backup-guard-license-js',
|
316 |
-
'BG_LICENSE_STRINGS',
|
317 |
-
array(
|
318 |
-
'invalidLicense' => _backupGuardT('Please choose a license first', true),
|
319 |
-
'availableLicenses' => _backupGuardT('There are no available licenses for using the selected product', true)
|
320 |
-
)
|
321 |
-
);
|
322 |
-
|
323 |
-
include_once plugin_dir_path(__FILE__) . 'public/link_license.php';
|
324 |
-
}
|
325 |
-
|
326 |
-
add_action('admin_enqueue_scripts', 'enqueue_backup_guard_scripts');
|
327 |
-
function enqueue_backup_guard_scripts($hook)
|
328 |
-
{
|
329 |
-
wp_enqueue_script('backup-guard-discount-notice', plugin_dir_url(__FILE__) . 'public/js/sgNoticeDismiss.js', array('jquery'), '1.0', true);
|
330 |
-
|
331 |
-
if (!strpos($hook, 'backup_guard')) {
|
332 |
-
if ($hook == "index.php") {
|
333 |
-
wp_enqueue_script('backup-guard-chart-manager', plugin_dir_url(__FILE__) . 'public/js/Chart.bundle.min.js');
|
334 |
-
}
|
335 |
-
return;
|
336 |
-
}
|
337 |
-
|
338 |
-
wp_enqueue_style('backup-guard-spinner', plugin_dir_url(__FILE__) . 'public/css/spinner.css');
|
339 |
-
wp_enqueue_style('backup-guard-wordpress', plugin_dir_url(__FILE__) . 'public/css/bgstyle.wordpress.css');
|
340 |
-
wp_enqueue_style('backup-guard-less', plugin_dir_url(__FILE__) . 'public/css/bgstyle.less.css');
|
341 |
-
wp_enqueue_style('backup-guard-styles', plugin_dir_url(__FILE__) . 'public/css/styles.css');
|
342 |
-
|
343 |
-
echo '<script type="text/javascript">sgBackup={};';
|
344 |
-
$sgAjaxRequestFrequency = SGConfig::get('SG_AJAX_REQUEST_FREQUENCY');
|
345 |
-
if (!$sgAjaxRequestFrequency) {
|
346 |
-
$sgAjaxRequestFrequency = SG_AJAX_DEFAULT_REQUEST_FREQUENCY;
|
347 |
-
}
|
348 |
-
echo 'SG_AJAX_REQUEST_FREQUENCY = "' . $sgAjaxRequestFrequency . '";';
|
349 |
-
echo 'function getAjaxUrl(url) {' .
|
350 |
-
'if (url==="cloudDropbox" || url==="cloudGdrive" || url==="cloudOneDrive" || url==="cloudPCloud" || url==="cloudBox") return "' . admin_url('admin-post.php?action=backup_guard_') . '"+url+"&token=' . wp_create_nonce('backupGuardAjaxNonce') . '";' .
|
351 |
-
'return "' . admin_url('admin-ajax.php') . '";}</script>';
|
352 |
-
|
353 |
-
wp_enqueue_media();
|
354 |
-
wp_enqueue_script('backup-guard-less-framework', plugin_dir_url(__FILE__) . 'public/js/less.min.js', array('jquery'), '1.0.0', true);
|
355 |
-
wp_enqueue_script('backup-guard-bootstrap-framework', plugin_dir_url(__FILE__) . 'public/js/bootstrap.min.js', array('jquery'), '1.0.0', true);
|
356 |
-
wp_enqueue_script('backup-guard-sgrequest-js', plugin_dir_url(__FILE__) . 'public/js/sgrequesthandler.js', array('jquery'), '1.0.0', true);
|
357 |
-
wp_enqueue_script('backup-guard-sgwprequest-js', plugin_dir_url(__FILE__) . 'public/js/sgrequesthandler.wordpress.js', array('jquery'), '1.0.0', true);
|
358 |
-
|
359 |
-
wp_enqueue_style('backup-guard-rateyo-css', plugin_dir_url(__FILE__) . 'public/css/jquery.rateyo.css');
|
360 |
-
wp_enqueue_script('backup-guard-rateyo-js', plugin_dir_url(__FILE__) . 'public/js/jquery.rateyo.js');
|
361 |
-
|
362 |
-
wp_enqueue_script('backup-guard-main-js', plugin_dir_url(__FILE__) . 'public/js/main.js', array('jquery'), '1.0.0', true);
|
363 |
-
wp_enqueue_script('backup-popup.js', plugin_dir_url(__FILE__) . 'public/js/popup.js', array('jquery'), '1.0.0', true);
|
364 |
-
wp_enqueue_style('popupTheme.css', plugin_dir_url(__FILE__) . 'public/css/popupTheme.css');
|
365 |
-
|
366 |
-
// Localize the script with new data
|
367 |
-
wp_localize_script(
|
368 |
-
'backup-guard-main-js',
|
369 |
-
'BG_MAIN_STRINGS',
|
370 |
-
array(
|
371 |
-
'confirmCancel' => _backupGuardT('Are you sure you want to cancel?', true)
|
372 |
-
)
|
373 |
-
);
|
374 |
-
|
375 |
-
wp_localize_script(
|
376 |
-
'backup-guard-main-js',
|
377 |
-
'BG_BACKUP_STRINGS',
|
378 |
-
array(
|
379 |
-
'nonce' => wp_create_nonce('backupGuardAjaxNonce')
|
380 |
-
)
|
381 |
-
);
|
382 |
-
}
|
383 |
-
|
384 |
-
// adding actions to handle modal ajax requests
|
385 |
-
add_action('wp_ajax_backup_guard_modalManualBackup', 'backup_guard_get_manual_modal');
|
386 |
-
add_action('wp_ajax_backup_guard_modalManualRestore', 'backup_guard_get_manual_restore_modal');
|
387 |
-
add_action('wp_ajax_backup_guard_modalImport', 'backup_guard_get_import_modal');
|
388 |
-
add_action('wp_ajax_backup_guard_modalFtpSettings', 'backup_guard_get_ftp_modal');
|
389 |
-
add_action('wp_ajax_backup_guard_modalAmazonSettings', 'backup_guard_get_amazon_modal');
|
390 |
-
add_action('wp_ajax_backup_guard_modalPrivacy', 'backup_guard_get_privacy_modal');
|
391 |
-
add_action('wp_ajax_backup_guard_modalTerms', 'backup_guard_get_terms_modal');
|
392 |
-
add_action('wp_ajax_backup_guard_modalReview', 'backup_guard_get_review_modal');
|
393 |
-
add_action('wp_ajax_backup_guard_getFileDownloadProgress', 'backup_guard_get_file_download_progress');
|
394 |
-
add_action('wp_ajax_backup_guard_modalCreateSchedule', 'backup_guard_create_schedule');
|
395 |
-
add_action('wp_ajax_backup_guard_getBackupContent', 'backup_guard_get_backup_content');
|
396 |
-
|
397 |
-
add_action('wp_ajax_backup_guard_modalBackupGuardDetails', 'backup_guard_get_backup_guard_modal');
|
398 |
-
|
399 |
-
function backup_guard_get_backup_guard_modal()
|
400 |
-
{
|
401 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
402 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalBackupGuardDetails.php';
|
403 |
-
exit();
|
404 |
-
}
|
405 |
-
|
406 |
-
function backup_guard_get_file_download_progress()
|
407 |
-
{
|
408 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
409 |
-
include_once SG_PUBLIC_AJAX_PATH . 'getFileDownloadProgress.php';
|
410 |
-
exit();
|
411 |
-
}
|
412 |
-
|
413 |
-
function backup_guard_create_schedule()
|
414 |
-
{
|
415 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
416 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalCreateSchedule.php';
|
417 |
-
exit();
|
418 |
-
}
|
419 |
-
|
420 |
-
function backup_guard_get_manual_modal()
|
421 |
-
{
|
422 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
423 |
-
if (current_user_can('activate_plugins') || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
424 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalManualBackup.php';
|
425 |
-
}
|
426 |
-
exit();
|
427 |
-
}
|
428 |
-
|
429 |
-
function backup_guard_get_manual_restore_modal()
|
430 |
-
{
|
431 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
432 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalManualRestore.php';
|
433 |
-
exit();
|
434 |
-
}
|
435 |
-
|
436 |
-
function backup_guard_get_backup_content()
|
437 |
-
{
|
438 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
439 |
-
include_once SG_PUBLIC_AJAX_PATH . 'getBackupContent.php';
|
440 |
-
exit();
|
441 |
-
}
|
442 |
-
|
443 |
-
function backup_guard_get_import_modal()
|
444 |
-
{
|
445 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
446 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalImport.php';
|
447 |
-
exit();
|
448 |
-
}
|
449 |
-
|
450 |
-
function backup_guard_get_ftp_modal()
|
451 |
-
{
|
452 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
453 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalFtpSettings.php';
|
454 |
-
exit();
|
455 |
-
}
|
456 |
-
|
457 |
-
function backup_guard_get_amazon_modal()
|
458 |
-
{
|
459 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
460 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalAmazonSettings.php';
|
461 |
-
exit();
|
462 |
-
}
|
463 |
-
|
464 |
-
function backup_guard_get_privacy_modal()
|
465 |
-
{
|
466 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalPrivacy.php';
|
467 |
-
}
|
468 |
-
|
469 |
-
function backup_guard_get_terms_modal()
|
470 |
-
{
|
471 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalTerms.php';
|
472 |
-
exit();
|
473 |
-
}
|
474 |
-
|
475 |
-
function backup_guard_get_review_modal()
|
476 |
-
{
|
477 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
478 |
-
include_once SG_PUBLIC_AJAX_PATH . 'modalReview.php';
|
479 |
-
exit();
|
480 |
-
}
|
481 |
-
|
482 |
-
function backup_guard_register_ajax_callbacks()
|
483 |
-
{
|
484 |
-
if (is_super_admin() || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
485 |
-
// adding actions to handle ajax and post requests
|
486 |
-
add_action('wp_ajax_backup_guard_cancelBackup', 'backup_guard_cancel_backup');
|
487 |
-
add_action('wp_ajax_backup_guard_checkBackupCreation', 'backup_guard_check_backup_creation');
|
488 |
-
add_action('wp_ajax_backup_guard_checkRestoreCreation', 'backup_guard_check_restore_creation');
|
489 |
-
add_action('wp_ajax_backup_guard_cloudDropbox', 'backup_guard_cloud_dropbox');
|
490 |
-
add_action('wp_ajax_backup_guard_send_usage_status', 'backup_guard_send_usage_status');
|
491 |
-
|
492 |
-
$pluginCapabilities = backupGuardGetCapabilities();
|
493 |
-
if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
|
494 |
-
include_once dirname(__FILE__) . '/BackupGuardPro.php';
|
495 |
-
}
|
496 |
-
add_action('wp_ajax_backup_guard_curlChecker', 'backup_guard_curl_checker');
|
497 |
-
add_action('wp_ajax_backup_guard_deleteBackup', 'backup_guard_delete_backup');
|
498 |
-
add_action('wp_ajax_backup_guard_getAction', 'backup_guard_get_action');
|
499 |
-
add_action('wp_ajax_backup_guard_getRunningActions', 'backup_guard_get_running_actions');
|
500 |
-
add_action('wp_ajax_backup_guard_importBackup', 'backup_guard_get_import_backup');
|
501 |
-
add_action('wp_ajax_backup_guard_resetStatus', 'backup_guard_reset_status');
|
502 |
-
add_action('wp_ajax_backup_guard_restore', 'backup_guard_restore');
|
503 |
-
add_action('wp_ajax_backup_guard_saveCloudFolder', 'backup_guard_save_cloud_folder');
|
504 |
-
add_action('wp_ajax_backup_guard_schedule', 'backup_guard_schedule');
|
505 |
-
add_action('wp_ajax_backup_guard_settings', 'backup_guard_settings');
|
506 |
-
add_action('wp_ajax_backup_guard_setReviewPopupState', 'backup_guard_set_review_popup_state');
|
507 |
-
add_action('wp_ajax_backup_guard_sendUsageStatistics', 'backup_guard_send_usage_statistics');
|
508 |
-
add_action('wp_ajax_backup_guard_hideNotice', 'backup_guard_hide_notice');
|
509 |
-
add_action('wp_ajax_backup_guard_downloadFromCloud', 'backup_guard_download_from_cloud');
|
510 |
-
add_action('wp_ajax_backup_guard_listStorage', 'backup_guard_list_storage');
|
511 |
-
add_action('wp_ajax_backup_guard_cancelDownload', 'backup_guard_cancel_download');
|
512 |
-
add_action('wp_ajax_backup_guard_awake', 'backup_guard_awake');
|
513 |
-
add_action('wp_ajax_backup_guard_manualBackup', 'backup_guard_manual_backup');
|
514 |
-
add_action('admin_post_backup_guard_downloadBackup', 'backup_guard_download_backup');
|
515 |
-
add_action('wp_ajax_backup_guard_login', 'backup_guard_login');
|
516 |
-
add_action('wp_ajax_backup_guard_logout', 'backup_guard_logout');
|
517 |
-
add_action('wp_ajax_backup_guard_link_license', 'backup_guard_link_license');
|
518 |
-
add_action('wp_ajax_backup_guard_importKeyFile', 'backup_guard_import_key_file');
|
519 |
-
add_action('wp_ajax_backup_guard_isFeatureAvailable', 'backup_guard_is_feature_available');
|
520 |
-
add_action('wp_ajax_backup_guard_dismiss_discount_notice', 'backup_guard_dismiss_discount_notice');
|
521 |
-
add_action('wp_ajax_backup_guard_checkFreeMigration', 'backup_guard_check_free_migration');
|
522 |
-
add_action('wp_ajax_backup_guard_checkPHPVersionCompatibility', 'backup_guard_check_php_version_compatibility');
|
523 |
-
add_action('wp_ajax_backup_guard_setUserInfoVerificationPopupState', 'backup_guard_set_user_info_verification_popup_state');
|
524 |
-
add_action('wp_ajax_backup_guard_storeSubscriberInfo', 'backup_guard_store_subscriber_info');
|
525 |
-
add_action('wp_ajax_backup_guard_storeSurveyResult', 'backup_guard_store_survey_result');
|
526 |
-
add_action('wp_ajax_backup_guard_reviewDontShow', 'backup_guard_review_dont_show');
|
527 |
-
add_action('wp_ajax_backup_guard_review_later', 'backup_guard_review_later');
|
528 |
-
add_action('wp_ajax_backup_guard_closeFreeBanner', 'wp_ajax_backup_guard_close_free_banner');
|
529 |
-
// related to cloud
|
530 |
-
add_action('wp_ajax_backup_guard_isBgUserExists', 'backup_guard_is_bg_user_exists');
|
531 |
-
add_action('wp_ajax_backup_guard_createCloudUser', 'backup_guard_create_cloud_user');
|
532 |
-
add_action('wp_ajax_backup_guard_bgAutoLogin', 'backup_guard_bg_auto_login');
|
533 |
-
add_action('wp_ajax_backup_guard_bgLogin', 'backup_guard_bg_login');
|
534 |
-
add_action('wp_ajax_backup_guard_chooseProfile', 'backup_guard_choose_profile');
|
535 |
-
}
|
536 |
-
}
|
537 |
-
|
538 |
-
function wp_ajax_backup_guard_close_free_banner()
|
539 |
-
{
|
540 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
541 |
-
SGConfig::set('SG_CLOSE_FREE_BANNER', 1);
|
542 |
-
wp_die();
|
543 |
-
}
|
544 |
-
|
545 |
-
function backup_guard_review_dont_show()
|
546 |
-
{
|
547 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
548 |
-
SGConfig::set('closeReviewBanner', 1);
|
549 |
-
wp_die();
|
550 |
-
}
|
551 |
-
|
552 |
-
function backup_guard_review_later()
|
553 |
-
{
|
554 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
555 |
-
include_once SG_PUBLIC_AJAX_PATH . 'reviewBannerActions.php';
|
556 |
-
wp_die();
|
557 |
-
}
|
558 |
-
|
559 |
-
function backup_guard_choose_profile()
|
560 |
-
{
|
561 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
562 |
-
include_once SG_PUBLIC_AJAX_PATH . 'chooseProfile.php';
|
563 |
-
}
|
564 |
-
|
565 |
-
function backup_guard_bg_login()
|
566 |
-
{
|
567 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
568 |
-
include_once SG_PUBLIC_AJAX_PATH . 'bgLogin.php';
|
569 |
-
}
|
570 |
-
|
571 |
-
function backup_guard_bg_auto_login()
|
572 |
-
{
|
573 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
574 |
-
include_once SG_PUBLIC_AJAX_PATH . 'bgAutoLogin.php';
|
575 |
-
}
|
576 |
-
|
577 |
-
function backup_guard_create_cloud_user()
|
578 |
-
{
|
579 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
580 |
-
include_once SG_PUBLIC_AJAX_PATH . 'createCloudUser.php';
|
581 |
-
}
|
582 |
-
|
583 |
-
function backup_guard_is_bg_user_exists()
|
584 |
-
{
|
585 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
586 |
-
include_once SG_PUBLIC_AJAX_PATH . 'isBgUserExists.php';
|
587 |
-
}
|
588 |
-
|
589 |
-
function backup_guard_store_survey_result()
|
590 |
-
{
|
591 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
592 |
-
include_once SG_PUBLIC_AJAX_PATH . 'storeSurveyResult.php';
|
593 |
-
}
|
594 |
-
|
595 |
-
function backup_guard_store_subscriber_info()
|
596 |
-
{
|
597 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
598 |
-
include_once SG_PUBLIC_AJAX_PATH . 'storeSubscriberInfo.php';
|
599 |
-
}
|
600 |
-
|
601 |
-
function backup_guard_set_user_info_verification_popup_state()
|
602 |
-
{
|
603 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
604 |
-
include_once SG_PUBLIC_AJAX_PATH . 'setUserInfoVerificationPopupState.php';
|
605 |
-
}
|
606 |
-
|
607 |
-
function backup_guard_dismiss_discount_notice()
|
608 |
-
{
|
609 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
610 |
-
include_once SG_PUBLIC_AJAX_PATH . 'dismissDiscountNotice.php';
|
611 |
-
}
|
612 |
-
|
613 |
-
function backup_guard_is_feature_available()
|
614 |
-
{
|
615 |
-
include_once SG_PUBLIC_AJAX_PATH . 'isFeatureAvailable.php';
|
616 |
-
}
|
617 |
-
|
618 |
-
function backup_guard_check_free_migration()
|
619 |
-
{
|
620 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
621 |
-
include_once SG_PUBLIC_AJAX_PATH . 'checkFreeMigration.php';
|
622 |
-
die;
|
623 |
-
}
|
624 |
-
|
625 |
-
function backup_guard_check_php_version_compatibility()
|
626 |
-
{
|
627 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
628 |
-
include_once SG_PUBLIC_AJAX_PATH . 'checkPHPVersionCompatibility.php';
|
629 |
-
}
|
630 |
-
|
631 |
-
add_action('init', 'backup_guard_init');
|
632 |
-
add_action('wp_ajax_nopriv_backup_guard_awake', 'backup_guard_awake_nopriv');
|
633 |
-
add_action('admin_post_backup_guard_cloudDropbox', 'backup_guard_cloud_dropbox');
|
634 |
-
|
635 |
-
function backup_guard_import_key_file()
|
636 |
-
{
|
637 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
638 |
-
include_once SG_PUBLIC_AJAX_PATH . 'importKeyFile.php';
|
639 |
-
}
|
640 |
-
|
641 |
-
function backup_guard_awake()
|
642 |
-
{
|
643 |
-
$method = SG_RELOAD_METHOD_AJAX;
|
644 |
-
include_once SG_PUBLIC_AJAX_PATH . 'awake.php';
|
645 |
-
}
|
646 |
-
|
647 |
-
function backup_guard_awake_nopriv()
|
648 |
-
{
|
649 |
-
$token = @$_GET['token'];
|
650 |
-
$method = @$_GET['method'];
|
651 |
-
|
652 |
-
if (backupGuardValidateApiCall($token)) {
|
653 |
-
include_once SG_PUBLIC_AJAX_PATH . 'awake.php';
|
654 |
-
}
|
655 |
-
}
|
656 |
-
|
657 |
-
function backup_guard_cancel_download()
|
658 |
-
{
|
659 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
660 |
-
include_once SG_PUBLIC_AJAX_PATH . 'cancelDownload.php';
|
661 |
-
}
|
662 |
-
|
663 |
-
function backup_guard_list_storage()
|
664 |
-
{
|
665 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
666 |
-
include_once SG_PUBLIC_AJAX_PATH . 'listStorage.php';
|
667 |
-
}
|
668 |
-
|
669 |
-
function backup_guard_download_from_cloud()
|
670 |
-
{
|
671 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
672 |
-
include_once SG_PUBLIC_AJAX_PATH . 'downloadFromCloud.php';
|
673 |
-
}
|
674 |
-
|
675 |
-
function backup_guard_hide_notice()
|
676 |
-
{
|
677 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
678 |
-
include_once SG_PUBLIC_AJAX_PATH . 'hideNotice.php';
|
679 |
-
}
|
680 |
-
|
681 |
-
function backup_guard_cancel_backup()
|
682 |
-
{
|
683 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
684 |
-
include_once SG_PUBLIC_AJAX_PATH . 'cancelBackup.php';
|
685 |
-
}
|
686 |
-
|
687 |
-
function backup_guard_check_backup_creation()
|
688 |
-
{
|
689 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
690 |
-
include_once SG_PUBLIC_AJAX_PATH . 'checkBackupCreation.php';
|
691 |
-
}
|
692 |
-
|
693 |
-
function backup_guard_check_restore_creation()
|
694 |
-
{
|
695 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
696 |
-
include_once SG_PUBLIC_AJAX_PATH . 'checkRestoreCreation.php';
|
697 |
-
}
|
698 |
-
|
699 |
-
function backup_guard_cloud_dropbox()
|
700 |
-
{
|
701 |
-
if (current_user_can('activate_plugins') || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
702 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
703 |
-
include_once SG_PUBLIC_AJAX_PATH . 'cloudDropbox.php';
|
704 |
-
}
|
705 |
-
}
|
706 |
-
|
707 |
-
function backup_guard_send_usage_status()
|
708 |
-
{
|
709 |
-
|
710 |
-
if (current_user_can('activate_plugins') || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
711 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
712 |
-
include_once SG_PUBLIC_AJAX_PATH . 'sendUsageStatus.php';
|
713 |
-
}
|
714 |
-
}
|
715 |
-
|
716 |
-
function backup_guard_curl_checker()
|
717 |
-
{
|
718 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
719 |
-
include_once SG_PUBLIC_AJAX_PATH . 'curlChecker.php';
|
720 |
-
}
|
721 |
-
|
722 |
-
function backup_guard_delete_backup()
|
723 |
-
{
|
724 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
725 |
-
include_once SG_PUBLIC_AJAX_PATH . 'deleteBackup.php';
|
726 |
-
}
|
727 |
-
|
728 |
-
function backup_guard_download_backup()
|
729 |
-
{
|
730 |
-
include_once SG_PUBLIC_AJAX_PATH . 'downloadBackup.php';
|
731 |
-
}
|
732 |
-
|
733 |
-
function backup_guard_get_action()
|
734 |
-
{
|
735 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
736 |
-
include_once SG_PUBLIC_AJAX_PATH . 'getAction.php';
|
737 |
-
}
|
738 |
-
|
739 |
-
function backup_guard_get_running_actions()
|
740 |
-
{
|
741 |
-
include_once SG_PUBLIC_AJAX_PATH . 'getRunningActions.php';
|
742 |
-
}
|
743 |
-
|
744 |
-
function backup_guard_get_import_backup()
|
745 |
-
{
|
746 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
747 |
-
include_once SG_PUBLIC_AJAX_PATH . 'importBackup.php';
|
748 |
-
}
|
749 |
-
|
750 |
-
function backup_guard_manual_backup()
|
751 |
-
{
|
752 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
753 |
-
include_once SG_PUBLIC_AJAX_PATH . 'manualBackup.php';
|
754 |
-
}
|
755 |
-
|
756 |
-
function backup_guard_reset_status()
|
757 |
-
{
|
758 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
759 |
-
include_once SG_PUBLIC_AJAX_PATH . 'resetStatus.php';
|
760 |
-
}
|
761 |
-
|
762 |
-
function backup_guard_restore()
|
763 |
-
{
|
764 |
-
include_once SG_PUBLIC_AJAX_PATH . 'restore.php';
|
765 |
-
}
|
766 |
-
|
767 |
-
function backup_guard_save_cloud_folder()
|
768 |
-
{
|
769 |
-
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
770 |
-
include_once SG_PUBLIC_AJAX_PATH . 'saveCloudFolder.php';
|
771 |
-
}
|
772 |
-
|
773 |
-
function backup_guard_schedule()
|
774 |
-
{
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
//
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
include_once dirname(__FILE__) . '/plugin-update-checker/
|
875 |
-
include_once dirname(__FILE__) . '/plugin-update-checker/Puc/v4/
|
876 |
-
include_once
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
$
|
881 |
-
|
882 |
-
|
883 |
-
SG_PRODUCT_IDENTIFIER
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
$
|
916 |
-
$
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
$
|
945 |
-
|
946 |
-
|
947 |
-
$
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
<div class="sgbg-col sgbg-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
background-
|
1010 |
-
background-
|
1011 |
-
background-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
background-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
font-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
font-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
color: #
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// hook to wordpres widget
|
4 |
+
function backup_guard_register_widget()
|
5 |
+
{
|
6 |
+
if (!class_exists('SGWordPressWidget')) {
|
7 |
+
@include_once SG_WIDGET_PATH . 'SGWordPressWidget.php';
|
8 |
+
}
|
9 |
+
|
10 |
+
register_widget('SGWordPressWidget');
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action('widgets_init', 'backup_guard_register_widget');
|
14 |
+
|
15 |
+
//The code that runs during plugin activation.
|
16 |
+
function activate_backup_guard()
|
17 |
+
{
|
18 |
+
//check if database should be updated
|
19 |
+
if (backupGuardShouldUpdate()) {
|
20 |
+
SGBoot::install();
|
21 |
+
SGBoot::didInstallForFirstTime();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
// The code that runs during plugin deactivation.
|
26 |
+
function uninstall_backup_guard()
|
27 |
+
{
|
28 |
+
SGBoot::uninstall();
|
29 |
+
}
|
30 |
+
|
31 |
+
function deactivate_backup_guard()
|
32 |
+
{
|
33 |
+
$pluginCapabilities = backupGuardGetCapabilities();
|
34 |
+
if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
|
35 |
+
include_once SG_LIB_PATH . 'SGAuthClient.php';
|
36 |
+
SGAuthClient::getInstance()->logout();
|
37 |
+
SGConfig::set('SG_LICENSE_CHECK_TS', 0, true);
|
38 |
+
SGConfig::set('SG_LOGGED_USER', '', true);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
function backupGuardMaybeShortenEddFilename($return, $package)
|
43 |
+
{
|
44 |
+
if (strpos($package, 'backup-guard') !== false) {
|
45 |
+
add_filter('wp_unique_filename', 'backupGuardShortenEddFilename', 10, 2);
|
46 |
+
}
|
47 |
+
return $return;
|
48 |
+
}
|
49 |
+
|
50 |
+
function backupGuardShortenEddFilename($filename, $ext)
|
51 |
+
{
|
52 |
+
$filename = substr($filename, 0, 20) . $ext;
|
53 |
+
remove_filter('wp_unique_filename', 'backupGuardShortenEddFilename', 10);
|
54 |
+
return $filename;
|
55 |
+
}
|
56 |
+
|
57 |
+
add_filter('upgrader_pre_download', 'backupGuardMaybeShortenEddFilename', 10, 4);
|
58 |
+
|
59 |
+
register_activation_hook(SG_BACKUP_GUARD_MAIN_FILE, 'activate_backup_guard');
|
60 |
+
register_uninstall_hook(SG_BACKUP_GUARD_MAIN_FILE, 'uninstall_backup_guard');
|
61 |
+
register_deactivation_hook(SG_BACKUP_GUARD_MAIN_FILE, 'deactivate_backup_guard');
|
62 |
+
//add_action('admin_footer', 'before_deactivate_backup_guard');
|
63 |
+
|
64 |
+
function before_deactivate_backup_guard()
|
65 |
+
{
|
66 |
+
wp_enqueue_style('before-deactivate-backup-guard-css', plugin_dir_url(__FILE__) . 'public/css/deactivationSurvey.css');
|
67 |
+
wp_enqueue_script('before-deactivate-backup-guard-js', plugin_dir_url(__FILE__) . 'public/js/deactivationSurvey.js', array('jquery'));
|
68 |
+
|
69 |
+
wp_localize_script(
|
70 |
+
'before-deactivate-backup-guard-js',
|
71 |
+
'BG_BACKUP_STRINGS_DEACTIVATE',
|
72 |
+
array('nonce' => wp_create_nonce('backupGuardAjaxNonce'),
|
73 |
+
'areYouSure' => _backupGuardT('Are you sure?', true),
|
74 |
+
'invalidCloud' => _backupGuardT('Please select at least 1 cloud', true)
|
75 |
+
)
|
76 |
+
);
|
77 |
+
|
78 |
+
include_once plugin_dir_path(__FILE__) . 'public/include/uninstallSurveyPopup.php';
|
79 |
+
}
|
80 |
+
|
81 |
+
// Register Admin Menus for single and multisite
|
82 |
+
if (is_multisite()) {
|
83 |
+
add_action('network_admin_menu', 'backup_guard_admin_menu');
|
84 |
+
} else {
|
85 |
+
add_action('admin_menu', 'backup_guard_admin_menu');
|
86 |
+
}
|
87 |
+
|
88 |
+
function backup_guard_admin_menu()
|
89 |
+
{
|
90 |
+
$capability = 'manage_options';
|
91 |
+
if (defined('SG_USER_MODE') && SG_USER_MODE) {
|
92 |
+
$capability = 'read';
|
93 |
+
}
|
94 |
+
|
95 |
+
add_menu_page('Backups', 'BackupGuard', $capability, 'backup_guard_backups', 'includeAllPages', 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MzAuMzQgNjYzLjAzIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkFydGJvYXJkIDI8L3RpdGxlPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTUzMC4xMSwxODUuNzljLTcxLjktOC44Mi0xMzcuNzMtNDAtMTkwLTg2LjU3djkyLjY1YTI4MC41OSwyODAuNTksMCwwLDAsMTE2LjUyLDUyYy05LjE0LDg5LjQzLTUyLDE2OS41NS0xMTYuNTIsMjI4Ljg3djkwLjRDNDU5Ljg0LDQ3Ny4xMyw1MzAuNiwzMzMuNDIsNTMwLjExLDE4NS43OVoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNzQuMjksMjQ0YTI4MC40NiwyODAuNDYsMCwwLDAsMTE1Ljc3LTUxLjExVjEwMGMtNTIuNDQsNDYuMjgtMTE3LjYyLDc3LTE4OS44Myw4NS4xNUM5OS41NCwzMzMsMTcwLjIyLDQ3Ni44MiwyOTAuMDYsNTYzVjQ3Mi4wOUMyMjYsNDEyLjg2LDE4My40MiwzMzMuMDYsMTc0LjI5LDI0NFoiLz48L3N2Zz4=', 74);
|
96 |
+
|
97 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Backups', true), _backupGuardT('Backups', true), $capability, 'backup_guard_backups', 'includeAllPages');
|
98 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Cloud', true), _backupGuardT('Cloud', true), $capability, 'backup_guard_cloud', 'includeAllPages');
|
99 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Schedule', true), _backupGuardT('Schedule', true), $capability, 'backup_guard_schedule', 'includeAllPages');
|
100 |
+
|
101 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Settings', true), _backupGuardT('Settings', true), $capability, 'backup_guard_settings', 'includeAllPages');
|
102 |
+
|
103 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('System Info.', true), _backupGuardT('System Info.', true), $capability, 'backup_guard_system_info', 'includeAllPages');
|
104 |
+
|
105 |
+
//add_submenu_page('backup_guard_backups', _backupGuardT('Services', true), _backupGuardT('Services', true), $capability, 'backup_guard_services', 'includeAllPages');
|
106 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Video Tutorials', true), _backupGuardT('Video Tutorials', true), $capability, 'backup_guard_videoTutorials', 'includeAllPages');
|
107 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Support', true), _backupGuardT('Support', true), $capability, 'backup_guard_support', 'includeAllPages');
|
108 |
+
|
109 |
+
//Check if should show upgrade page
|
110 |
+
if (SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE')) {
|
111 |
+
add_submenu_page('backup_guard_backups', _backupGuardT('Why upgrade?', true), _backupGuardT('Why upgrade?', true), $capability, 'backup_guard_pro_features', 'includeAllPages');
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
function getBackupPageContentClassName($pageName = '')
|
116 |
+
{
|
117 |
+
$hiddenClassName = 'sg-visibility-hidden';
|
118 |
+
$page = $_GET['page'];
|
119 |
+
|
120 |
+
if (strpos($page, $pageName)) {
|
121 |
+
$hiddenClassName = '';
|
122 |
+
}
|
123 |
+
|
124 |
+
return $hiddenClassName;
|
125 |
+
}
|
126 |
+
|
127 |
+
function includeAllPages()
|
128 |
+
{
|
129 |
+
if (!backupGuardValidateLicense()) {
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
backup_guard_backups_page();
|
133 |
+
backup_guard_cloud_page();
|
134 |
+
backup_guard_system_info_page();
|
135 |
+
backup_guard_services_page();
|
136 |
+
backup_guard_pro_features_page();
|
137 |
+
backup_guard_support_page();
|
138 |
+
backup_guard_schedule_page();
|
139 |
+
backup_guard_settings_page();
|
140 |
+
|
141 |
+
include_once plugin_dir_path(__FILE__) . 'public/pagesContent.php';
|
142 |
+
|
143 |
+
return true;
|
144 |
+
}
|
145 |
+
|
146 |
+
function backup_guard_system_info_page()
|
147 |
+
{
|
148 |
+
if (backupGuardValidateLicense()) {
|
149 |
+
//require_once(plugin_dir_path(__FILE__).'public/systemInfo.php');
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
function backup_guard_services_page()
|
154 |
+
{
|
155 |
+
if (backupGuardValidateLicense()) {
|
156 |
+
//require_once(plugin_dir_path(__FILE__).'public/services.php');
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
//Pro features page
|
161 |
+
function backup_guard_pro_features_page()
|
162 |
+
{
|
163 |
+
// require_once(plugin_dir_path(__FILE__).'public/proFeatures.php');
|
164 |
+
}
|
165 |
+
|
166 |
+
function backup_guard_security_page()
|
167 |
+
{
|
168 |
+
include_once plugin_dir_path(__FILE__) . 'public/security.php';
|
169 |
+
}
|
170 |
+
|
171 |
+
//Support page
|
172 |
+
function backup_guard_support_page()
|
173 |
+
{
|
174 |
+
if (backupGuardValidateLicense()) {
|
175 |
+
// require_once(plugin_dir_path(__FILE__).'public/support.php');
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
//Backups Page
|
180 |
+
function backup_guard_backups_page()
|
181 |
+
{
|
182 |
+
if (backupGuardValidateLicense()) {
|
183 |
+
wp_enqueue_script('backup-guard-iframe-transport-js', plugin_dir_url(__FILE__) . 'public/js/jquery.iframe-transport.js', array('jquery'));
|
184 |
+
wp_enqueue_script('backup-guard-fileupload-js', plugin_dir_url(__FILE__) . 'public/js/jquery.fileupload.js', array('jquery'));
|
185 |
+
wp_enqueue_script('backup-guard-jstree-js', plugin_dir_url(__FILE__) . 'public/js/jstree.min.js', array('jquery'));
|
186 |
+
wp_enqueue_script('backup-guard-jstree-checkbox-js', plugin_dir_url(__FILE__) . 'public/js/jstree.checkbox.js', array('jquery'));
|
187 |
+
wp_enqueue_script('backup-guard-jstree-wholerow-js', plugin_dir_url(__FILE__) . 'public/js/jstree.wholerow.js', array('jquery'));
|
188 |
+
wp_enqueue_script('backup-guard-jstree-types-js', plugin_dir_url(__FILE__) . 'public/js/jstree.types.js', array('jquery'));
|
189 |
+
wp_enqueue_style('backup-guard-jstree-css', plugin_dir_url(__FILE__) . 'public/css/default/style.min.css');
|
190 |
+
wp_enqueue_script('backup-guard-backups-js', plugin_dir_url(__FILE__) . 'public/js/sgbackup.js', array('jquery',
|
191 |
+
'jquery-effects-core', 'jquery-effects-transfer', 'jquery-ui-widget'));
|
192 |
+
|
193 |
+
// Localize the script with new data
|
194 |
+
wp_localize_script(
|
195 |
+
'backup-guard-backups-js',
|
196 |
+
'BG_BACKUP_STRINGS',
|
197 |
+
array(
|
198 |
+
'confirm' => _backupGuardT('Are you sure you want to cancel import?', true),
|
199 |
+
'nonce' => wp_create_nonce('backupGuardAjaxNonce'),
|
200 |
+
'invalidBackupOption' => _backupGuardT('Please choose at least one option.', true),
|
201 |
+
'invalidDirectorySelected' => _backupGuardT('Please choose at least one directory.', true),
|
202 |
+
'invalidCloud' => _backupGuardT('Please choose at least one cloud.', true),
|
203 |
+
'backupInProgress' => _backupGuardT('Backing Up...', true),
|
204 |
+
'errorMessage' => _backupGuardT('Something went wrong. Please try again.', true),
|
205 |
+
'noBackupsAvailable' => _backupGuardT('No backups found.', true),
|
206 |
+
'invalidImportOption' => _backupGuardT('Please select one of the options.', true),
|
207 |
+
'invalidDownloadFile' => _backupGuardT('Please choose one of the files.', true),
|
208 |
+
'import' => _backupGuardT('Import', true),
|
209 |
+
'importInProgress' => _backupGuardT('Importing please wait...', true),
|
210 |
+
'fileUploadFailed' => _backupGuardT('File upload failed.', true)
|
211 |
+
)
|
212 |
+
);
|
213 |
+
|
214 |
+
// require_once(plugin_dir_path( __FILE__ ).'public/backups.php');
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
//Cloud Page
|
219 |
+
function backup_guard_cloud_page()
|
220 |
+
{
|
221 |
+
if (backupGuardValidateLicense()) {
|
222 |
+
wp_enqueue_style('backup-guard-switch-css', plugin_dir_url(__FILE__) . 'public/css/bootstrap-switch.min.css');
|
223 |
+
wp_enqueue_script('backup-guard-switch-js', plugin_dir_url(__FILE__) . 'public/js/bootstrap-switch.min.js', array('jquery'), SG_BACKUP_GUARD_VERSION, true);
|
224 |
+
wp_enqueue_script('backup-guard-jquery-validate-js', plugin_dir_url(__FILE__) . 'public/js/jquery.validate.min.js', array('jquery',
|
225 |
+
'backup-guard-switch-js'), SG_BACKUP_GUARD_VERSION, true);
|
226 |
+
wp_enqueue_script('backup-guard-cloud-js', plugin_dir_url(__FILE__) . 'public/js/sgcloud.js', array('jquery',
|
227 |
+
'backup-guard-switch-js'), SG_BACKUP_GUARD_VERSION, true);
|
228 |
+
|
229 |
+
// Localize the script with new data
|
230 |
+
wp_localize_script(
|
231 |
+
'backup-guard-cloud-js',
|
232 |
+
'BG_CLOUD_STRINGS',
|
233 |
+
array(
|
234 |
+
'invalidImportFile' => _backupGuardT('Please select a file.', true),
|
235 |
+
'invalidFileSize' => _backupGuardT('File is too large.', true),
|
236 |
+
'connectionInProgress' => _backupGuardT('Connecting...', true),
|
237 |
+
'invalidDestinationFolder' => _backupGuardT('Destination folder is required.', true),
|
238 |
+
'invalidDestinationFolderName' => _backupGuardT('Destination folder: type only letters, numbers and ""―".', true),
|
239 |
+
'successMessage' => _backupGuardT('Successfully saved.', true)
|
240 |
+
)
|
241 |
+
);
|
242 |
+
|
243 |
+
//require_once(plugin_dir_path(__FILE__).'public/cloud.php');
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
//Schedule Page
|
248 |
+
function backup_guard_schedule_page()
|
249 |
+
{
|
250 |
+
if (backupGuardValidateLicense()) {
|
251 |
+
wp_enqueue_style('backup-guard-switch-css', plugin_dir_url(__FILE__) . 'public/css/bootstrap-switch.min.css');
|
252 |
+
wp_enqueue_script('backup-guard-switch-js', plugin_dir_url(__FILE__) . 'public/js/bootstrap-switch.min.js', array('jquery'), '1.0.0', true);
|
253 |
+
wp_enqueue_script('backup-guard-schedule-js', plugin_dir_url(__FILE__) . 'public/js/sgschedule.js', array('jquery'), '1.0.0', true);
|
254 |
+
|
255 |
+
// Localize the script with new data
|
256 |
+
wp_localize_script(
|
257 |
+
'backup-guard-schedule-js',
|
258 |
+
'BG_SCHEDULE_STRINGS',
|
259 |
+
array(
|
260 |
+
'deletionError' => _backupGuardT('Unable to delete schedule', true),
|
261 |
+
'confirm' => _backupGuardT('Are you sure?', true),
|
262 |
+
'invalidBackupOption' => _backupGuardT('Please choose at least one option.', true),
|
263 |
+
'invalidDirectorySelected' => _backupGuardT('Please choose at least one directory.', true),
|
264 |
+
'invalidCloud' => _backupGuardT('Please choose at least one cloud.', true),
|
265 |
+
'savingInProgress' => _backupGuardT('Saving...', true),
|
266 |
+
'successMessage' => _backupGuardT('You have successfully activated schedule.', true),
|
267 |
+
'saveButtonText' => _backupGuardT('Save', true)
|
268 |
+
)
|
269 |
+
);
|
270 |
+
|
271 |
+
// require_once(plugin_dir_path( __FILE__ ).'public/schedule.php');
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
//Settings Page
|
276 |
+
function backup_guard_settings_page()
|
277 |
+
{
|
278 |
+
if (backupGuardValidateLicense()) {
|
279 |
+
wp_enqueue_style('backup-guard-switch-css', plugin_dir_url(__FILE__) . 'public/css/bootstrap-switch.min.css');
|
280 |
+
wp_enqueue_script('backup-guard-switch-js', plugin_dir_url(__FILE__) . 'public/js/bootstrap-switch.min.js', array('jquery'), '1.0.0', true);
|
281 |
+
wp_enqueue_script('backup-guard-settings-js', plugin_dir_url(__FILE__) . 'public/js/sgsettings.js', array('jquery'), '1.0.0', true);
|
282 |
+
|
283 |
+
// Localize the script with new data
|
284 |
+
wp_localize_script(
|
285 |
+
'backup-guard-settings-js',
|
286 |
+
'BG_SETTINGS_STRINGS',
|
287 |
+
array(
|
288 |
+
'invalidEmailAddress' => _backupGuardT('Please enter valid email.', true),
|
289 |
+
'invalidFileName' => _backupGuardT('Please enter valid file name.', true),
|
290 |
+
'invalidRetentionNumber' => _backupGuardT('Please enter a valid retention number.', true),
|
291 |
+
'successMessage' => _backupGuardT('Successfully saved.', true),
|
292 |
+
'savingInProgress' => _backupGuardT('Saving...', true),
|
293 |
+
'retentionConfirmationFirstPart' => _backupGuardT('Are you sure you want to keep the latest', true),
|
294 |
+
'retentionConfirmationSecondPart' => _backupGuardT('backups? All older backups will be deleted.', true),
|
295 |
+
'saveButtonText' => _backupGuardT('Save', true)
|
296 |
+
)
|
297 |
+
);
|
298 |
+
|
299 |
+
//require_once(plugin_dir_path(__FILE__).'public/settings.php');
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
function backup_guard_login_page()
|
304 |
+
{
|
305 |
+
wp_enqueue_script('backup-guard-login-js', plugin_dir_url(__FILE__) . 'public/js/sglogin.js', array('jquery'), '1.0.0', true);
|
306 |
+
|
307 |
+
include_once plugin_dir_path(__FILE__) . 'public/login.php';
|
308 |
+
}
|
309 |
+
|
310 |
+
function backup_guard_link_license_page()
|
311 |
+
{
|
312 |
+
wp_enqueue_script('backup-guard-license-js', plugin_dir_url(__FILE__) . 'public/js/sglicense.js', array('jquery'), '1.0.0', true);
|
313 |
+
// Localize the script with new data
|
314 |
+
wp_localize_script(
|
315 |
+
'backup-guard-license-js',
|
316 |
+
'BG_LICENSE_STRINGS',
|
317 |
+
array(
|
318 |
+
'invalidLicense' => _backupGuardT('Please choose a license first', true),
|
319 |
+
'availableLicenses' => _backupGuardT('There are no available licenses for using the selected product', true)
|
320 |
+
)
|
321 |
+
);
|
322 |
+
|
323 |
+
include_once plugin_dir_path(__FILE__) . 'public/link_license.php';
|
324 |
+
}
|
325 |
+
|
326 |
+
add_action('admin_enqueue_scripts', 'enqueue_backup_guard_scripts');
|
327 |
+
function enqueue_backup_guard_scripts($hook)
|
328 |
+
{
|
329 |
+
wp_enqueue_script('backup-guard-discount-notice', plugin_dir_url(__FILE__) . 'public/js/sgNoticeDismiss.js', array('jquery'), '1.0', true);
|
330 |
+
|
331 |
+
if (!strpos($hook, 'backup_guard')) {
|
332 |
+
if ($hook == "index.php") {
|
333 |
+
wp_enqueue_script('backup-guard-chart-manager', plugin_dir_url(__FILE__) . 'public/js/Chart.bundle.min.js');
|
334 |
+
}
|
335 |
+
return;
|
336 |
+
}
|
337 |
+
|
338 |
+
wp_enqueue_style('backup-guard-spinner', plugin_dir_url(__FILE__) . 'public/css/spinner.css');
|
339 |
+
wp_enqueue_style('backup-guard-wordpress', plugin_dir_url(__FILE__) . 'public/css/bgstyle.wordpress.css');
|
340 |
+
wp_enqueue_style('backup-guard-less', plugin_dir_url(__FILE__) . 'public/css/bgstyle.less.css');
|
341 |
+
wp_enqueue_style('backup-guard-styles', plugin_dir_url(__FILE__) . 'public/css/styles.css');
|
342 |
+
|
343 |
+
echo '<script type="text/javascript">sgBackup={};';
|
344 |
+
$sgAjaxRequestFrequency = SGConfig::get('SG_AJAX_REQUEST_FREQUENCY');
|
345 |
+
if (!$sgAjaxRequestFrequency) {
|
346 |
+
$sgAjaxRequestFrequency = SG_AJAX_DEFAULT_REQUEST_FREQUENCY;
|
347 |
+
}
|
348 |
+
echo 'SG_AJAX_REQUEST_FREQUENCY = "' . $sgAjaxRequestFrequency . '";';
|
349 |
+
echo 'function getAjaxUrl(url) {' .
|
350 |
+
'if (url==="cloudDropbox" || url==="cloudGdrive" || url==="cloudOneDrive" || url==="cloudPCloud" || url==="cloudBox") return "' . admin_url('admin-post.php?action=backup_guard_') . '"+url+"&token=' . wp_create_nonce('backupGuardAjaxNonce') . '";' .
|
351 |
+
'return "' . admin_url('admin-ajax.php') . '";}</script>';
|
352 |
+
|
353 |
+
wp_enqueue_media();
|
354 |
+
wp_enqueue_script('backup-guard-less-framework', plugin_dir_url(__FILE__) . 'public/js/less.min.js', array('jquery'), '1.0.0', true);
|
355 |
+
wp_enqueue_script('backup-guard-bootstrap-framework', plugin_dir_url(__FILE__) . 'public/js/bootstrap.min.js', array('jquery'), '1.0.0', true);
|
356 |
+
wp_enqueue_script('backup-guard-sgrequest-js', plugin_dir_url(__FILE__) . 'public/js/sgrequesthandler.js', array('jquery'), '1.0.0', true);
|
357 |
+
wp_enqueue_script('backup-guard-sgwprequest-js', plugin_dir_url(__FILE__) . 'public/js/sgrequesthandler.wordpress.js', array('jquery'), '1.0.0', true);
|
358 |
+
|
359 |
+
wp_enqueue_style('backup-guard-rateyo-css', plugin_dir_url(__FILE__) . 'public/css/jquery.rateyo.css');
|
360 |
+
wp_enqueue_script('backup-guard-rateyo-js', plugin_dir_url(__FILE__) . 'public/js/jquery.rateyo.js');
|
361 |
+
|
362 |
+
wp_enqueue_script('backup-guard-main-js', plugin_dir_url(__FILE__) . 'public/js/main.js', array('jquery'), '1.0.0', true);
|
363 |
+
wp_enqueue_script('backup-popup.js', plugin_dir_url(__FILE__) . 'public/js/popup.js', array('jquery'), '1.0.0', true);
|
364 |
+
wp_enqueue_style('popupTheme.css', plugin_dir_url(__FILE__) . 'public/css/popupTheme.css');
|
365 |
+
|
366 |
+
// Localize the script with new data
|
367 |
+
wp_localize_script(
|
368 |
+
'backup-guard-main-js',
|
369 |
+
'BG_MAIN_STRINGS',
|
370 |
+
array(
|
371 |
+
'confirmCancel' => _backupGuardT('Are you sure you want to cancel?', true)
|
372 |
+
)
|
373 |
+
);
|
374 |
+
|
375 |
+
wp_localize_script(
|
376 |
+
'backup-guard-main-js',
|
377 |
+
'BG_BACKUP_STRINGS',
|
378 |
+
array(
|
379 |
+
'nonce' => wp_create_nonce('backupGuardAjaxNonce')
|
380 |
+
)
|
381 |
+
);
|
382 |
+
}
|
383 |
+
|
384 |
+
// adding actions to handle modal ajax requests
|
385 |
+
add_action('wp_ajax_backup_guard_modalManualBackup', 'backup_guard_get_manual_modal');
|
386 |
+
add_action('wp_ajax_backup_guard_modalManualRestore', 'backup_guard_get_manual_restore_modal');
|
387 |
+
add_action('wp_ajax_backup_guard_modalImport', 'backup_guard_get_import_modal');
|
388 |
+
add_action('wp_ajax_backup_guard_modalFtpSettings', 'backup_guard_get_ftp_modal');
|
389 |
+
add_action('wp_ajax_backup_guard_modalAmazonSettings', 'backup_guard_get_amazon_modal');
|
390 |
+
add_action('wp_ajax_backup_guard_modalPrivacy', 'backup_guard_get_privacy_modal');
|
391 |
+
add_action('wp_ajax_backup_guard_modalTerms', 'backup_guard_get_terms_modal');
|
392 |
+
add_action('wp_ajax_backup_guard_modalReview', 'backup_guard_get_review_modal');
|
393 |
+
add_action('wp_ajax_backup_guard_getFileDownloadProgress', 'backup_guard_get_file_download_progress');
|
394 |
+
add_action('wp_ajax_backup_guard_modalCreateSchedule', 'backup_guard_create_schedule');
|
395 |
+
add_action('wp_ajax_backup_guard_getBackupContent', 'backup_guard_get_backup_content');
|
396 |
+
|
397 |
+
add_action('wp_ajax_backup_guard_modalBackupGuardDetails', 'backup_guard_get_backup_guard_modal');
|
398 |
+
|
399 |
+
function backup_guard_get_backup_guard_modal()
|
400 |
+
{
|
401 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
402 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalBackupGuardDetails.php';
|
403 |
+
exit();
|
404 |
+
}
|
405 |
+
|
406 |
+
function backup_guard_get_file_download_progress()
|
407 |
+
{
|
408 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
409 |
+
include_once SG_PUBLIC_AJAX_PATH . 'getFileDownloadProgress.php';
|
410 |
+
exit();
|
411 |
+
}
|
412 |
+
|
413 |
+
function backup_guard_create_schedule()
|
414 |
+
{
|
415 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
416 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalCreateSchedule.php';
|
417 |
+
exit();
|
418 |
+
}
|
419 |
+
|
420 |
+
function backup_guard_get_manual_modal()
|
421 |
+
{
|
422 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
423 |
+
if (current_user_can('activate_plugins') || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
424 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalManualBackup.php';
|
425 |
+
}
|
426 |
+
exit();
|
427 |
+
}
|
428 |
+
|
429 |
+
function backup_guard_get_manual_restore_modal()
|
430 |
+
{
|
431 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
432 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalManualRestore.php';
|
433 |
+
exit();
|
434 |
+
}
|
435 |
+
|
436 |
+
function backup_guard_get_backup_content()
|
437 |
+
{
|
438 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
439 |
+
include_once SG_PUBLIC_AJAX_PATH . 'getBackupContent.php';
|
440 |
+
exit();
|
441 |
+
}
|
442 |
+
|
443 |
+
function backup_guard_get_import_modal()
|
444 |
+
{
|
445 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
446 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalImport.php';
|
447 |
+
exit();
|
448 |
+
}
|
449 |
+
|
450 |
+
function backup_guard_get_ftp_modal()
|
451 |
+
{
|
452 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
453 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalFtpSettings.php';
|
454 |
+
exit();
|
455 |
+
}
|
456 |
+
|
457 |
+
function backup_guard_get_amazon_modal()
|
458 |
+
{
|
459 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
460 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalAmazonSettings.php';
|
461 |
+
exit();
|
462 |
+
}
|
463 |
+
|
464 |
+
function backup_guard_get_privacy_modal()
|
465 |
+
{
|
466 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalPrivacy.php';
|
467 |
+
}
|
468 |
+
|
469 |
+
function backup_guard_get_terms_modal()
|
470 |
+
{
|
471 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalTerms.php';
|
472 |
+
exit();
|
473 |
+
}
|
474 |
+
|
475 |
+
function backup_guard_get_review_modal()
|
476 |
+
{
|
477 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
478 |
+
include_once SG_PUBLIC_AJAX_PATH . 'modalReview.php';
|
479 |
+
exit();
|
480 |
+
}
|
481 |
+
|
482 |
+
function backup_guard_register_ajax_callbacks()
|
483 |
+
{
|
484 |
+
if (is_super_admin() || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
485 |
+
// adding actions to handle ajax and post requests
|
486 |
+
add_action('wp_ajax_backup_guard_cancelBackup', 'backup_guard_cancel_backup');
|
487 |
+
add_action('wp_ajax_backup_guard_checkBackupCreation', 'backup_guard_check_backup_creation');
|
488 |
+
add_action('wp_ajax_backup_guard_checkRestoreCreation', 'backup_guard_check_restore_creation');
|
489 |
+
add_action('wp_ajax_backup_guard_cloudDropbox', 'backup_guard_cloud_dropbox');
|
490 |
+
add_action('wp_ajax_backup_guard_send_usage_status', 'backup_guard_send_usage_status');
|
491 |
+
|
492 |
+
$pluginCapabilities = backupGuardGetCapabilities();
|
493 |
+
if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
|
494 |
+
include_once dirname(__FILE__) . '/BackupGuardPro.php';
|
495 |
+
}
|
496 |
+
add_action('wp_ajax_backup_guard_curlChecker', 'backup_guard_curl_checker');
|
497 |
+
add_action('wp_ajax_backup_guard_deleteBackup', 'backup_guard_delete_backup');
|
498 |
+
add_action('wp_ajax_backup_guard_getAction', 'backup_guard_get_action');
|
499 |
+
add_action('wp_ajax_backup_guard_getRunningActions', 'backup_guard_get_running_actions');
|
500 |
+
add_action('wp_ajax_backup_guard_importBackup', 'backup_guard_get_import_backup');
|
501 |
+
add_action('wp_ajax_backup_guard_resetStatus', 'backup_guard_reset_status');
|
502 |
+
add_action('wp_ajax_backup_guard_restore', 'backup_guard_restore');
|
503 |
+
add_action('wp_ajax_backup_guard_saveCloudFolder', 'backup_guard_save_cloud_folder');
|
504 |
+
add_action('wp_ajax_backup_guard_schedule', 'backup_guard_schedule');
|
505 |
+
add_action('wp_ajax_backup_guard_settings', 'backup_guard_settings');
|
506 |
+
add_action('wp_ajax_backup_guard_setReviewPopupState', 'backup_guard_set_review_popup_state');
|
507 |
+
add_action('wp_ajax_backup_guard_sendUsageStatistics', 'backup_guard_send_usage_statistics');
|
508 |
+
add_action('wp_ajax_backup_guard_hideNotice', 'backup_guard_hide_notice');
|
509 |
+
add_action('wp_ajax_backup_guard_downloadFromCloud', 'backup_guard_download_from_cloud');
|
510 |
+
add_action('wp_ajax_backup_guard_listStorage', 'backup_guard_list_storage');
|
511 |
+
add_action('wp_ajax_backup_guard_cancelDownload', 'backup_guard_cancel_download');
|
512 |
+
add_action('wp_ajax_backup_guard_awake', 'backup_guard_awake');
|
513 |
+
add_action('wp_ajax_backup_guard_manualBackup', 'backup_guard_manual_backup');
|
514 |
+
add_action('admin_post_backup_guard_downloadBackup', 'backup_guard_download_backup');
|
515 |
+
add_action('wp_ajax_backup_guard_login', 'backup_guard_login');
|
516 |
+
add_action('wp_ajax_backup_guard_logout', 'backup_guard_logout');
|
517 |
+
add_action('wp_ajax_backup_guard_link_license', 'backup_guard_link_license');
|
518 |
+
add_action('wp_ajax_backup_guard_importKeyFile', 'backup_guard_import_key_file');
|
519 |
+
add_action('wp_ajax_backup_guard_isFeatureAvailable', 'backup_guard_is_feature_available');
|
520 |
+
add_action('wp_ajax_backup_guard_dismiss_discount_notice', 'backup_guard_dismiss_discount_notice');
|
521 |
+
add_action('wp_ajax_backup_guard_checkFreeMigration', 'backup_guard_check_free_migration');
|
522 |
+
add_action('wp_ajax_backup_guard_checkPHPVersionCompatibility', 'backup_guard_check_php_version_compatibility');
|
523 |
+
add_action('wp_ajax_backup_guard_setUserInfoVerificationPopupState', 'backup_guard_set_user_info_verification_popup_state');
|
524 |
+
add_action('wp_ajax_backup_guard_storeSubscriberInfo', 'backup_guard_store_subscriber_info');
|
525 |
+
add_action('wp_ajax_backup_guard_storeSurveyResult', 'backup_guard_store_survey_result');
|
526 |
+
add_action('wp_ajax_backup_guard_reviewDontShow', 'backup_guard_review_dont_show');
|
527 |
+
add_action('wp_ajax_backup_guard_review_later', 'backup_guard_review_later');
|
528 |
+
add_action('wp_ajax_backup_guard_closeFreeBanner', 'wp_ajax_backup_guard_close_free_banner');
|
529 |
+
// related to cloud
|
530 |
+
add_action('wp_ajax_backup_guard_isBgUserExists', 'backup_guard_is_bg_user_exists');
|
531 |
+
add_action('wp_ajax_backup_guard_createCloudUser', 'backup_guard_create_cloud_user');
|
532 |
+
add_action('wp_ajax_backup_guard_bgAutoLogin', 'backup_guard_bg_auto_login');
|
533 |
+
add_action('wp_ajax_backup_guard_bgLogin', 'backup_guard_bg_login');
|
534 |
+
add_action('wp_ajax_backup_guard_chooseProfile', 'backup_guard_choose_profile');
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
function wp_ajax_backup_guard_close_free_banner()
|
539 |
+
{
|
540 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
541 |
+
SGConfig::set('SG_CLOSE_FREE_BANNER', 1);
|
542 |
+
wp_die();
|
543 |
+
}
|
544 |
+
|
545 |
+
function backup_guard_review_dont_show()
|
546 |
+
{
|
547 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
548 |
+
SGConfig::set('closeReviewBanner', 1);
|
549 |
+
wp_die();
|
550 |
+
}
|
551 |
+
|
552 |
+
function backup_guard_review_later()
|
553 |
+
{
|
554 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
555 |
+
include_once SG_PUBLIC_AJAX_PATH . 'reviewBannerActions.php';
|
556 |
+
wp_die();
|
557 |
+
}
|
558 |
+
|
559 |
+
function backup_guard_choose_profile()
|
560 |
+
{
|
561 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
562 |
+
include_once SG_PUBLIC_AJAX_PATH . 'chooseProfile.php';
|
563 |
+
}
|
564 |
+
|
565 |
+
function backup_guard_bg_login()
|
566 |
+
{
|
567 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
568 |
+
include_once SG_PUBLIC_AJAX_PATH . 'bgLogin.php';
|
569 |
+
}
|
570 |
+
|
571 |
+
function backup_guard_bg_auto_login()
|
572 |
+
{
|
573 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
574 |
+
include_once SG_PUBLIC_AJAX_PATH . 'bgAutoLogin.php';
|
575 |
+
}
|
576 |
+
|
577 |
+
function backup_guard_create_cloud_user()
|
578 |
+
{
|
579 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
580 |
+
include_once SG_PUBLIC_AJAX_PATH . 'createCloudUser.php';
|
581 |
+
}
|
582 |
+
|
583 |
+
function backup_guard_is_bg_user_exists()
|
584 |
+
{
|
585 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
586 |
+
include_once SG_PUBLIC_AJAX_PATH . 'isBgUserExists.php';
|
587 |
+
}
|
588 |
+
|
589 |
+
function backup_guard_store_survey_result()
|
590 |
+
{
|
591 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
592 |
+
include_once SG_PUBLIC_AJAX_PATH . 'storeSurveyResult.php';
|
593 |
+
}
|
594 |
+
|
595 |
+
function backup_guard_store_subscriber_info()
|
596 |
+
{
|
597 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
598 |
+
include_once SG_PUBLIC_AJAX_PATH . 'storeSubscriberInfo.php';
|
599 |
+
}
|
600 |
+
|
601 |
+
function backup_guard_set_user_info_verification_popup_state()
|
602 |
+
{
|
603 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
604 |
+
include_once SG_PUBLIC_AJAX_PATH . 'setUserInfoVerificationPopupState.php';
|
605 |
+
}
|
606 |
+
|
607 |
+
function backup_guard_dismiss_discount_notice()
|
608 |
+
{
|
609 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
610 |
+
include_once SG_PUBLIC_AJAX_PATH . 'dismissDiscountNotice.php';
|
611 |
+
}
|
612 |
+
|
613 |
+
function backup_guard_is_feature_available()
|
614 |
+
{
|
615 |
+
include_once SG_PUBLIC_AJAX_PATH . 'isFeatureAvailable.php';
|
616 |
+
}
|
617 |
+
|
618 |
+
function backup_guard_check_free_migration()
|
619 |
+
{
|
620 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
621 |
+
include_once SG_PUBLIC_AJAX_PATH . 'checkFreeMigration.php';
|
622 |
+
die;
|
623 |
+
}
|
624 |
+
|
625 |
+
function backup_guard_check_php_version_compatibility()
|
626 |
+
{
|
627 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
628 |
+
include_once SG_PUBLIC_AJAX_PATH . 'checkPHPVersionCompatibility.php';
|
629 |
+
}
|
630 |
+
|
631 |
+
add_action('init', 'backup_guard_init');
|
632 |
+
add_action('wp_ajax_nopriv_backup_guard_awake', 'backup_guard_awake_nopriv');
|
633 |
+
add_action('admin_post_backup_guard_cloudDropbox', 'backup_guard_cloud_dropbox');
|
634 |
+
|
635 |
+
function backup_guard_import_key_file()
|
636 |
+
{
|
637 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
638 |
+
include_once SG_PUBLIC_AJAX_PATH . 'importKeyFile.php';
|
639 |
+
}
|
640 |
+
|
641 |
+
function backup_guard_awake()
|
642 |
+
{
|
643 |
+
$method = SG_RELOAD_METHOD_AJAX;
|
644 |
+
include_once SG_PUBLIC_AJAX_PATH . 'awake.php';
|
645 |
+
}
|
646 |
+
|
647 |
+
function backup_guard_awake_nopriv()
|
648 |
+
{
|
649 |
+
$token = @$_GET['token'];
|
650 |
+
$method = @$_GET['method'];
|
651 |
+
|
652 |
+
if (backupGuardValidateApiCall($token)) {
|
653 |
+
include_once SG_PUBLIC_AJAX_PATH . 'awake.php';
|
654 |
+
}
|
655 |
+
}
|
656 |
+
|
657 |
+
function backup_guard_cancel_download()
|
658 |
+
{
|
659 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
660 |
+
include_once SG_PUBLIC_AJAX_PATH . 'cancelDownload.php';
|
661 |
+
}
|
662 |
+
|
663 |
+
function backup_guard_list_storage()
|
664 |
+
{
|
665 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
666 |
+
include_once SG_PUBLIC_AJAX_PATH . 'listStorage.php';
|
667 |
+
}
|
668 |
+
|
669 |
+
function backup_guard_download_from_cloud()
|
670 |
+
{
|
671 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
672 |
+
include_once SG_PUBLIC_AJAX_PATH . 'downloadFromCloud.php';
|
673 |
+
}
|
674 |
+
|
675 |
+
function backup_guard_hide_notice()
|
676 |
+
{
|
677 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
678 |
+
include_once SG_PUBLIC_AJAX_PATH . 'hideNotice.php';
|
679 |
+
}
|
680 |
+
|
681 |
+
function backup_guard_cancel_backup()
|
682 |
+
{
|
683 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
684 |
+
include_once SG_PUBLIC_AJAX_PATH . 'cancelBackup.php';
|
685 |
+
}
|
686 |
+
|
687 |
+
function backup_guard_check_backup_creation()
|
688 |
+
{
|
689 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
690 |
+
include_once SG_PUBLIC_AJAX_PATH . 'checkBackupCreation.php';
|
691 |
+
}
|
692 |
+
|
693 |
+
function backup_guard_check_restore_creation()
|
694 |
+
{
|
695 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
696 |
+
include_once SG_PUBLIC_AJAX_PATH . 'checkRestoreCreation.php';
|
697 |
+
}
|
698 |
+
|
699 |
+
function backup_guard_cloud_dropbox()
|
700 |
+
{
|
701 |
+
if (current_user_can('activate_plugins') || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
702 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
703 |
+
include_once SG_PUBLIC_AJAX_PATH . 'cloudDropbox.php';
|
704 |
+
}
|
705 |
+
}
|
706 |
+
|
707 |
+
function backup_guard_send_usage_status()
|
708 |
+
{
|
709 |
+
|
710 |
+
if (current_user_can('activate_plugins') || (defined('SG_USER_MODE') && SG_USER_MODE)) {
|
711 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
712 |
+
include_once SG_PUBLIC_AJAX_PATH . 'sendUsageStatus.php';
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
function backup_guard_curl_checker()
|
717 |
+
{
|
718 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
719 |
+
include_once SG_PUBLIC_AJAX_PATH . 'curlChecker.php';
|
720 |
+
}
|
721 |
+
|
722 |
+
function backup_guard_delete_backup()
|
723 |
+
{
|
724 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
725 |
+
include_once SG_PUBLIC_AJAX_PATH . 'deleteBackup.php';
|
726 |
+
}
|
727 |
+
|
728 |
+
function backup_guard_download_backup()
|
729 |
+
{
|
730 |
+
include_once SG_PUBLIC_AJAX_PATH . 'downloadBackup.php';
|
731 |
+
}
|
732 |
+
|
733 |
+
function backup_guard_get_action()
|
734 |
+
{
|
735 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
736 |
+
include_once SG_PUBLIC_AJAX_PATH . 'getAction.php';
|
737 |
+
}
|
738 |
+
|
739 |
+
function backup_guard_get_running_actions()
|
740 |
+
{
|
741 |
+
include_once SG_PUBLIC_AJAX_PATH . 'getRunningActions.php';
|
742 |
+
}
|
743 |
+
|
744 |
+
function backup_guard_get_import_backup()
|
745 |
+
{
|
746 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
747 |
+
include_once SG_PUBLIC_AJAX_PATH . 'importBackup.php';
|
748 |
+
}
|
749 |
+
|
750 |
+
function backup_guard_manual_backup()
|
751 |
+
{
|
752 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
753 |
+
include_once SG_PUBLIC_AJAX_PATH . 'manualBackup.php';
|
754 |
+
}
|
755 |
+
|
756 |
+
function backup_guard_reset_status()
|
757 |
+
{
|
758 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
759 |
+
include_once SG_PUBLIC_AJAX_PATH . 'resetStatus.php';
|
760 |
+
}
|
761 |
+
|
762 |
+
function backup_guard_restore()
|
763 |
+
{
|
764 |
+
include_once SG_PUBLIC_AJAX_PATH . 'restore.php';
|
765 |
+
}
|
766 |
+
|
767 |
+
function backup_guard_save_cloud_folder()
|
768 |
+
{
|
769 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
770 |
+
include_once SG_PUBLIC_AJAX_PATH . 'saveCloudFolder.php';
|
771 |
+
}
|
772 |
+
|
773 |
+
function backup_guard_schedule()
|
774 |
+
{
|
775 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
776 |
+
include_once SG_PUBLIC_AJAX_PATH . 'schedule.php';
|
777 |
+
}
|
778 |
+
|
779 |
+
function backup_guard_settings()
|
780 |
+
{
|
781 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
782 |
+
include_once SG_PUBLIC_AJAX_PATH . 'settings.php';
|
783 |
+
}
|
784 |
+
|
785 |
+
function backup_guard_set_review_popup_state()
|
786 |
+
{
|
787 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
788 |
+
include_once SG_PUBLIC_AJAX_PATH . 'setReviewPopupState.php';
|
789 |
+
}
|
790 |
+
|
791 |
+
function backup_guard_send_usage_statistics()
|
792 |
+
{
|
793 |
+
include_once SG_PUBLIC_AJAX_PATH . 'sendUsageStatistics.php';
|
794 |
+
}
|
795 |
+
|
796 |
+
function backup_guard_login()
|
797 |
+
{
|
798 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
799 |
+
include_once SG_PUBLIC_AJAX_PATH . 'login.php';
|
800 |
+
}
|
801 |
+
|
802 |
+
function backup_guard_logout()
|
803 |
+
{
|
804 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
805 |
+
include_once SG_PUBLIC_AJAX_PATH . 'logout.php';
|
806 |
+
}
|
807 |
+
|
808 |
+
function backup_guard_link_license()
|
809 |
+
{
|
810 |
+
check_ajax_referer('backupGuardAjaxNonce', 'token');
|
811 |
+
include_once SG_PUBLIC_AJAX_PATH . 'linkLicense.php';
|
812 |
+
}
|
813 |
+
|
814 |
+
//adds once weekly to the existing schedules.
|
815 |
+
add_filter('cron_schedules', 'backup_guard_cron_add_weekly');
|
816 |
+
function backup_guard_cron_add_weekly($schedules)
|
817 |
+
{
|
818 |
+
$schedules['weekly'] = array(
|
819 |
+
'interval' => 60 * 60 * 24 * 7,
|
820 |
+
'display' => 'Once weekly'
|
821 |
+
);
|
822 |
+
return $schedules;
|
823 |
+
}
|
824 |
+
|
825 |
+
//adds once monthly to the existing schedules.
|
826 |
+
add_filter('cron_schedules', 'backup_guard_cron_add_monthly');
|
827 |
+
function backup_guard_cron_add_monthly($schedules)
|
828 |
+
{
|
829 |
+
$schedules['monthly'] = array(
|
830 |
+
'interval' => 60 * 60 * 24 * 30,
|
831 |
+
'display' => 'Once monthly'
|
832 |
+
);
|
833 |
+
return $schedules;
|
834 |
+
}
|
835 |
+
|
836 |
+
//adds once yearly to the existing schedules.
|
837 |
+
add_filter('cron_schedules', 'backup_guard_cron_add_yearly');
|
838 |
+
function backup_guard_cron_add_yearly($schedules)
|
839 |
+
{
|
840 |
+
$schedules['yearly'] = array(
|
841 |
+
'interval' => 60 * 60 * 24 * 30 * 12,
|
842 |
+
'display' => 'Once yearly'
|
843 |
+
);
|
844 |
+
return $schedules;
|
845 |
+
}
|
846 |
+
|
847 |
+
function backup_guard_init()
|
848 |
+
{
|
849 |
+
backup_guard_register_ajax_callbacks();
|
850 |
+
// backupGuardPluginRedirect();
|
851 |
+
|
852 |
+
//check if database should be updated
|
853 |
+
if (backupGuardShouldUpdate()) {
|
854 |
+
SGBoot::install();
|
855 |
+
}
|
856 |
+
|
857 |
+
backupGuardSymlinksCleanup(SG_SYMLINK_PATH);
|
858 |
+
}
|
859 |
+
|
860 |
+
add_action(SG_SCHEDULE_ACTION, 'backup_guard_schedule_action', 10, 1);
|
861 |
+
|
862 |
+
function backup_guard_schedule_action($id)
|
863 |
+
{
|
864 |
+
include_once SG_PUBLIC_PATH . 'cron/sg_backup.php';
|
865 |
+
}
|
866 |
+
|
867 |
+
function sgBackupAdminInit()
|
868 |
+
{
|
869 |
+
//load pro plugin updater
|
870 |
+
$pluginCapabilities = backupGuardGetCapabilities();
|
871 |
+
$isLoggedIn = is_user_logged_in();
|
872 |
+
|
873 |
+
if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE && $isLoggedIn) {
|
874 |
+
include_once dirname(__FILE__) . '/plugin-update-checker/plugin-update-checker.php';
|
875 |
+
include_once dirname(__FILE__) . '/plugin-update-checker/Puc/v4/Utils.php';
|
876 |
+
include_once dirname(__FILE__) . '/plugin-update-checker/Puc/v4/UpdateChecker.php';
|
877 |
+
include_once dirname(__FILE__) . '/plugin-update-checker/Puc/v4/Scheduler.php';
|
878 |
+
include_once SG_LIB_PATH . 'SGAuthClient.php';
|
879 |
+
|
880 |
+
$licenseKey = SGConfig::get('SG_LICENSE_KEY');
|
881 |
+
|
882 |
+
$updateChecker = Puc_v4_Factory::buildUpdateChecker(
|
883 |
+
BackupGuard\Config::URL . '/products/details/' . $licenseKey . '/' . SG_PRODUCT_IDENTIFIER,
|
884 |
+
SG_BACKUP_GUARD_MAIN_FILE,
|
885 |
+
SG_PRODUCT_IDENTIFIER
|
886 |
+
);
|
887 |
+
|
888 |
+
$updateChecker->addHttpRequestArgFilter(
|
889 |
+
array(
|
890 |
+
SGAuthClient::getInstance(),
|
891 |
+
'filterUpdateChecks'
|
892 |
+
)
|
893 |
+
);
|
894 |
+
}
|
895 |
+
|
896 |
+
include_once SG_LIB_PATH . 'SGStatsRequests.php';
|
897 |
+
SGStatsRequests::initialSync();
|
898 |
+
}
|
899 |
+
|
900 |
+
add_action('admin_init', 'sgBackupAdminInit');
|
901 |
+
|
902 |
+
if (SGBoot::isFeatureAvailable('ALERT_BEFORE_UPDATE')) {
|
903 |
+
add_filter('upgrader_pre_download', 'backupGuardOnBeforeUpdateDownload', 10, 3);
|
904 |
+
add_action('core_upgrade_preamble', 'backupGuardOnUpgradeScreenActivate');
|
905 |
+
add_action('current_screen', 'backupGuardOnScreenActivate');
|
906 |
+
}
|
907 |
+
|
908 |
+
// Register the new dashboard widget with the 'wp_dashboard_setup' action
|
909 |
+
add_action('wp_dashboard_setup', 'backup_guard_add_dashboard_widgets');
|
910 |
+
|
911 |
+
function backup_guard_add_dashboard_widgets()
|
912 |
+
{
|
913 |
+
include_once SG_CORE_PATH . 'SGConfig.php';
|
914 |
+
|
915 |
+
$userId = get_current_user_id();
|
916 |
+
$userData = get_userdata($userId);
|
917 |
+
$userRoles = $userData->roles;
|
918 |
+
$isAdminUser = false;
|
919 |
+
for ($i = 0; $i < count($userRoles); $i++) {
|
920 |
+
if ($userRoles[$i] == "administrator") {
|
921 |
+
$isAdminUser = true;
|
922 |
+
break;
|
923 |
+
}
|
924 |
+
}
|
925 |
+
|
926 |
+
if (!$isAdminUser) {
|
927 |
+
return;
|
928 |
+
}
|
929 |
+
|
930 |
+
$isShowStatisticsWidgetEnabled = SGConfig::get('SG_SHOW_STATISTICS_WIDGET');
|
931 |
+
if (!$isShowStatisticsWidgetEnabled) {
|
932 |
+
return;
|
933 |
+
}
|
934 |
+
|
935 |
+
|
936 |
+
include_once plugin_dir_path(__FILE__) . 'public/dashboardWidget.php';
|
937 |
+
wp_add_dashboard_widget('backupGuardWidget', 'Backup Guard', 'backup_guard_dashboard_widget_function');
|
938 |
+
}
|
939 |
+
|
940 |
+
add_action('plugins_loaded', 'backupGuardloadTextDomain');
|
941 |
+
function backupGuardloadTextDomain()
|
942 |
+
{
|
943 |
+
$backupGuardLangDir = plugin_dir_path(__FILE__) . 'languages/';
|
944 |
+
$backupGuardLangDir = apply_filters('backupguardLanguagesDirectory', $backupGuardLangDir);
|
945 |
+
|
946 |
+
$locale = apply_filters('bg_plugin_locale', get_locale(), BACKUP_GUARD_TEXTDOMAIN);
|
947 |
+
$mofile = sprintf('%1$s-%2$s.mo', BACKUP_GUARD_TEXTDOMAIN, $locale);
|
948 |
+
|
949 |
+
$mofileLocal = $backupGuardLangDir . $mofile;
|
950 |
+
|
951 |
+
if (file_exists($mofileLocal)) {
|
952 |
+
// Look in local /wp-content/plugins/popup-builder/languages/ folder
|
953 |
+
load_textdomain(BACKUP_GUARD_TEXTDOMAIN, $mofileLocal);
|
954 |
+
} else {
|
955 |
+
// Load the default language files
|
956 |
+
load_plugin_textdomain(BACKUP_GUARD_TEXTDOMAIN, false, $backupGuardLangDir);
|
957 |
+
}
|
958 |
+
}
|
959 |
+
|
960 |
+
if (backupGuardShouldShowDiscountNotice() && checkDueDateDiscount()) {
|
961 |
+
add_action('admin_notices', 'backup_guard_discount_notice');
|
962 |
+
}
|
963 |
+
|
964 |
+
function backup_guard_discount_notice()
|
965 |
+
{
|
966 |
+
/*$capabilities = backupGuardGetCapabilities();
|
967 |
+
$upgradeUrl = BG_UPGRADE_URL;*/
|
968 |
+
?>
|
969 |
+
<div class="backup-guard-discount-notice updated notice is-dismissible">
|
970 |
+
<div class="sgbg-col sgbg-col1"></div>
|
971 |
+
<div class="sgbg-col sgbg-col2"></div>
|
972 |
+
<div class="sgbg-col sgbg-col3">
|
973 |
+
<div class="sgbg-text-col-1">
|
974 |
+
-50%
|
975 |
+
</div>
|
976 |
+
<div class="sgbg-text-col-2">
|
977 |
+
<div class="sgbg-discount-text-1">Discount</div>
|
978 |
+
<div class="sgbg-discount-text-2">All Backup Guard Solutions</div>
|
979 |
+
</div>
|
980 |
+
</div>
|
981 |
+
<div class="sgbg-col sgbg-col4">
|
982 |
+
<a href="https://backup-guard.com/products/backup-wordpress" target="_blank">
|
983 |
+
<button class="sgbg-button">Click Here</button>
|
984 |
+
</a>
|
985 |
+
</div>
|
986 |
+
</div>
|
987 |
+
<style>
|
988 |
+
.backup-guard-discount-notice.updated.notice.is-dismissible {
|
989 |
+
padding: 0;
|
990 |
+
border-left-color: #FFFFFF !important;
|
991 |
+
background-color: #000000;
|
992 |
+
height: 160px;
|
993 |
+
}
|
994 |
+
|
995 |
+
.backup-guard-discount-notice button:before {
|
996 |
+
color: #ffffff !important;
|
997 |
+
}
|
998 |
+
|
999 |
+
.sgbg-col {
|
1000 |
+
display: inline-block;
|
1001 |
+
width: 25%;
|
1002 |
+
height: 100%;
|
1003 |
+
padding: 0 25px;
|
1004 |
+
box-sizing: border-box;
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
.sgbg-col1 {
|
1008 |
+
width: 10%;
|
1009 |
+
background-color: #FFFFFF;
|
1010 |
+
background-image: url("<?php echo SG_IMAGE_URL ?>BgBFLogo.jpg");
|
1011 |
+
background-size: 80%;
|
1012 |
+
background-repeat: no-repeat;
|
1013 |
+
background-position: center;
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
.sgbg-col2 {
|
1017 |
+
width: 20%;
|
1018 |
+
background-image: url("<?php echo SG_IMAGE_URL ?>BF.png");
|
1019 |
+
background-size: contain;
|
1020 |
+
margin-left: 70px;
|
1021 |
+
background-position: center;
|
1022 |
+
background-repeat: no-repeat;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
.sgbg-col3 {
|
1026 |
+
vertical-align: top;
|
1027 |
+
width: 45%;
|
1028 |
+
margin-top: 55px;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
.sgbg-col4 {
|
1032 |
+
width: 10%;
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
.sgbg-text-col-1,
|
1036 |
+
.sgbg-text-col-2 {
|
1037 |
+
width: 49%;
|
1038 |
+
display: inline-block;
|
1039 |
+
color: #FFFFFF;
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
.sgbg-text-col-1 {
|
1043 |
+
font-size: 100px;
|
1044 |
+
line-height: 0;
|
1045 |
+
font-weight: bold;
|
1046 |
+
text-align: right;
|
1047 |
+
padding-right: 26px;
|
1048 |
+
box-sizing: border-box;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
.sgbg-discount-text-2 {
|
1052 |
+
font-size: 19px;
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
.sgbg-discount-text-1 {
|
1056 |
+
font-size: 60px;
|
1057 |
+
padding-bottom: 27px;
|
1058 |
+
font-weight: bold;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
.sgbg-col4 {
|
1062 |
+
vertical-align: top;
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
.sgbg-button {
|
1066 |
+
width: 183px;
|
1067 |
+
height: 67px;
|
1068 |
+
font-size: 20px;
|
1069 |
+
border: #ffffff;
|
1070 |
+
border-radius: 10px;
|
1071 |
+
margin-top: 48px;
|
1072 |
+
background-color: #FFFFFF;
|
1073 |
+
color: #000000;
|
1074 |
+
cursor: pointer !important;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
.sgbg-button:hover {
|
1078 |
+
background-color: #000000;
|
1079 |
+
border: 1px solid #FFFFFF;
|
1080 |
+
color: #FFFFFF;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
.backup-guard-discount-notice .notice-dismiss::before {
|
1084 |
+
content: "x";
|
1085 |
+
font-weight: 300;
|
1086 |
+
font-family: Arial, sans-serif;
|
1087 |
+
}
|
1088 |
+
|
1089 |
+
@media (max-width: 1810px) {
|
1090 |
+
.sgbg-text-col-1 {
|
1091 |
+
font-size: 80px;
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
.sgbg-discount-text-1 {
|
1095 |
+
font-size: 43px;
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
.sgbg-discount-text-2 {
|
1099 |
+
font-size: 15px;
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
.sgbg-discount-text-1 {
|
1103 |
+
padding-bottom: 18px;
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
.sgbg-col3 {
|
1107 |
+
margin-top: 60px;
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
@media (max-width: 1477px) {
|
1112 |
+
.sgbg-discount-text-2 {
|
1113 |
+
font-size: 12px;
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
.sgbg-discount-text-1 {
|
1117 |
+
font-size: 35px;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
.sgbg-discount-text-1 {
|
1121 |
+
padding-bottom: 13px;
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
.sgbg-col {
|
1125 |
+
padding: 0;
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
.sgbg-col2 {
|
1129 |
+
margin-left: 40px;
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
.sgbg-col2 {
|
1133 |
+
margin-left: 0;
|
1134 |
+
}
|
1135 |
+
}
|
1136 |
+
</style>
|
1137 |
+
<?php
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
add_action('admin_notices', 'backup_guard_review_banner');
|
1141 |
+
function backup_guard_review_banner()
|
1142 |
+
{
|
1143 |
+
include_once SG_LIB_PATH . 'SGReviewManager.php';
|
1144 |
+
$reviewManager = new SGReviewManager();
|
1145 |
+
$reviewManager->renderContent();
|
1146 |
+
}
|
README.txt
CHANGED
@@ -6,7 +6,7 @@ Donate link: https://backup-guard.com/products/backup-wordpress
|
|
6 |
Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
|
7 |
Requires at least: 5.3
|
8 |
Tested up to: 6.0
|
9 |
-
Stable tag: 1.6.9
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -168,6 +168,9 @@ When you are facing an issue of any kind with any of our products, the first thi
|
|
168 |
|
169 |
== Changelog ==
|
170 |
|
|
|
|
|
|
|
171 |
= 1.6.9 =
|
172 |
* Improvement of backup process: Duplicated files are removed from backing up for better backup process
|
173 |
* Improvement of Dropbox: During authentication refresh token has been added
|
6 |
Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
|
7 |
Requires at least: 5.3
|
8 |
Tested up to: 6.0
|
9 |
+
Stable tag: 1.6.9.1
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
168 |
|
169 |
== Changelog ==
|
170 |
|
171 |
+
= 1.6.9.1 =
|
172 |
+
* Bug fixed related to security issues
|
173 |
+
|
174 |
= 1.6.9 =
|
175 |
* Improvement of backup process: Duplicated files are removed from backing up for better backup process
|
176 |
* Improvement of Dropbox: During authentication refresh token has been added
|
backup.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin Name: Backup
|
5 |
-
* Plugin URI: https://backup-guard.com/products/backup-wordpress
|
6 |
-
* Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
|
7 |
-
* Version: 1.6.9
|
8 |
-
* Author: BackupGuard
|
9 |
-
* Author URI: https://backup-guard.com/products/backup-wordpress
|
10 |
-
* License: GPL-2.0+
|
11 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
12 |
-
*/
|
13 |
-
|
14 |
-
if (function_exists('activate_backup_guard')) {
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
if (!defined('SG_BACKUP_GUARD_VERSION')) {
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
if (!defined('SG_FORCE_DB_TABLES_RESET')) {
|
27 |
-
|
28 |
-
}
|
29 |
-
|
30 |
-
//if this file is called directly, abort.
|
31 |
-
if (!defined('WPINC')) {
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
require_once(plugin_dir_path(__FILE__).'public/boot.php');
|
36 |
-
require_once(plugin_dir_path(__FILE__).'BackupGuard.php');
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Name: Backup
|
5 |
+
* Plugin URI: https://backup-guard.com/products/backup-wordpress
|
6 |
+
* Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
|
7 |
+
* Version: 1.6.9.1
|
8 |
+
* Author: BackupGuard
|
9 |
+
* Author URI: https://backup-guard.com/products/backup-wordpress
|
10 |
+
* License: GPL-2.0+
|
11 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
12 |
+
*/
|
13 |
+
|
14 |
+
if (function_exists('activate_backup_guard')) {
|
15 |
+
die('Please deactivate any other BackupGuard version before activating this one.');
|
16 |
+
}
|
17 |
+
|
18 |
+
if (!defined('SG_BACKUP_GUARD_VERSION')) {
|
19 |
+
define('SG_BACKUP_GUARD_VERSION', '1.6.9.1');
|
20 |
+
}
|
21 |
+
|
22 |
+
if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
|
23 |
+
define('SG_BACKUP_GUARD_MAIN_FILE', __FILE__);
|
24 |
+
}
|
25 |
+
|
26 |
+
if (!defined('SG_FORCE_DB_TABLES_RESET')) {
|
27 |
+
define('SG_FORCE_DB_TABLES_RESET', false);
|
28 |
+
}
|
29 |
+
|
30 |
+
//if this file is called directly, abort.
|
31 |
+
if (!defined('WPINC')) {
|
32 |
+
die;
|
33 |
+
}
|
34 |
+
|
35 |
+
require_once(plugin_dir_path(__FILE__) . 'public/boot.php');
|
36 |
+
require_once(plugin_dir_path(__FILE__) . 'BackupGuard.php');
|
public/backups.php
CHANGED
@@ -178,7 +178,7 @@ This will provide us with an opportunity to make the experience so much better f
|
|
178 |
<?php foreach ($backups as $backup) : ?>
|
179 |
<tr>
|
180 |
<td><input type="checkbox" autocomplete="off"
|
181 |
-
value="<?php echo $backup['name'] ?>" <?php echo $backup['active'] ? 'disabled' : '' ?>>
|
182 |
</td>
|
183 |
<td><?php echo $backup['name'] ?></td>
|
184 |
<td><?php echo !$backup['active'] ? $backup['size'] : '' ?></td>
|
@@ -212,7 +212,7 @@ This will provide us with an opportunity to make the experience so much better f
|
|
212 |
<span class="btn-xs text-danger" data-toggle="tooltip" data-placement="top"
|
213 |
data-original-title="
|
214 |
<?php if ($backup['type'] == SG_ACTION_TYPE_BACKUP) :
|
215 |
-
|
216 |
elseif ($backup['type'] == SG_ACTION_TYPE_RESTORE) :
|
217 |
echo _backupGuardT('Errors found during restore', true);
|
218 |
else :
|
178 |
<?php foreach ($backups as $backup) : ?>
|
179 |
<tr>
|
180 |
<td><input type="checkbox" autocomplete="off"
|
181 |
+
value="<?php echo esc_attr($backup['name']) ?>" <?php echo $backup['active'] ? 'disabled' : '' ?>>
|
182 |
</td>
|
183 |
<td><?php echo $backup['name'] ?></td>
|
184 |
<td><?php echo !$backup['active'] ? $backup['size'] : '' ?></td>
|
212 |
<span class="btn-xs text-danger" data-toggle="tooltip" data-placement="top"
|
213 |
data-original-title="
|
214 |
<?php if ($backup['type'] == SG_ACTION_TYPE_BACKUP) :
|
215 |
+
echo _backupGuardT('Errors found during backup', true);
|
216 |
elseif ($backup['type'] == SG_ACTION_TYPE_RESTORE) :
|
217 |
echo _backupGuardT('Errors found during restore', true);
|
218 |
else :
|
public/js/sgschedule.js
CHANGED
@@ -1,251 +1,251 @@
|
|
1 |
-
// phpcs:ignoreFile
|
2 |
-
BG_SCHEDULE_INTERVAL_HOURLY = 0;
|
3 |
-
BG_SCHEDULE_INTERVAL_DAILY = 1;
|
4 |
-
BG_SCHEDULE_INTERVAL_WEEKLY = 2;
|
5 |
-
BG_SCHEDULE_INTERVAL_MONTHLY = 3;
|
6 |
-
BG_SCHEDULE_INTERVAL_YEARLY = 4;
|
7 |
-
|
8 |
-
jQuery(document).ready(
|
9 |
-
function () {
|
10 |
-
sgBackup.initTablePagination('sg-schedule');
|
11 |
-
sgBackup.initScheduleCreation();
|
12 |
-
}
|
13 |
-
);
|
14 |
-
|
15 |
-
sgBackup.initScheduleCreation = function () {
|
16 |
-
sgBackup.initScheduleSwitchButtons();
|
17 |
-
sgBackup.initManulBackupRadioInputs();
|
18 |
-
sgBackup.initManualBackupTooltips();
|
19 |
-
sgBackup.toggleDaySelection();
|
20 |
-
sgBackup.initIntervalSelection();
|
21 |
-
}
|
22 |
-
|
23 |
-
sgBackup.removeSchedule = function (id) {
|
24 |
-
var ajaxHandler = new sgRequestHandler('schedule', {remove: true, id: id});
|
25 |
-
|
26 |
-
if (!confirm(BG_SCHEDULE_STRINGS.confirm)) {
|
27 |
-
return false;
|
28 |
-
}
|
29 |
-
|
30 |
-
ajaxHandler.callback = function (response) {
|
31 |
-
jQuery('.alert').remove();
|
32 |
-
|
33 |
-
if (typeof response.success !== 'undefined') {
|
34 |
-
location.reload();
|
35 |
-
} else {
|
36 |
-
//if error
|
37 |
-
var alert = sgBackup.alertGenerator(BG_SCHEDULE_STRINGS.deletionError, 'alert-danger');
|
38 |
-
jQuery('.sg-schedule-container legend').after(alert);
|
39 |
-
}
|
40 |
-
|
41 |
-
sgBackup.scrollToElement('.alert');
|
42 |
-
};
|
43 |
-
ajaxHandler.run();
|
44 |
-
}
|
45 |
-
|
46 |
-
sgBackup.initIntervalSelection = function () {
|
47 |
-
if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_WEEKLY) {
|
48 |
-
jQuery('#sg-schedule-day-of-week-select').show();
|
49 |
-
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_MONTHLY) {
|
50 |
-
jQuery('#sg-schedule-day-of-month-select').show();
|
51 |
-
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_HOURLY) {
|
52 |
-
jQuery('#sg-schedule-timezone').hide();
|
53 |
-
}
|
54 |
-
|
55 |
-
jQuery('#sg-schedule-interval').on(
|
56 |
-
'change', function () {
|
57 |
-
jQuery('#sg-schedule-timezone').show();
|
58 |
-
if (jQuery(this).val() == BG_SCHEDULE_INTERVAL_WEEKLY) {
|
59 |
-
jQuery('#sg-schedule-month-of-year-select').hide();
|
60 |
-
jQuery('#sg-schedule-day-of-month-select').hide();
|
61 |
-
jQuery('#sg-schedule-day-of-week-select').show();
|
62 |
-
} else if (jQuery(this).val() == BG_SCHEDULE_INTERVAL_MONTHLY) {
|
63 |
-
jQuery('#sg-schedule-month-of-year-select').hide();
|
64 |
-
jQuery('#sg-schedule-day-of-week-select').hide();
|
65 |
-
jQuery('#sg-schedule-day-of-month-select').show();
|
66 |
-
sgBackup.updateDaysOfMonth();
|
67 |
-
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_HOURLY) {
|
68 |
-
jQuery('#sg-schedule-timezone').hide();
|
69 |
-
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_DAILY) {
|
70 |
-
sgBackup.toggleDaySelection();
|
71 |
-
} else {
|
72 |
-
jQuery('#sg-schedule-month-of-year-select').show();
|
73 |
-
jQuery('#sg-schedule-day-of-week-select').hide();
|
74 |
-
jQuery('#sg-schedule-day-of-month-select').show();
|
75 |
-
sgBackup.updateDaysOfMonth();
|
76 |
-
}
|
77 |
-
}
|
78 |
-
);
|
79 |
-
}
|
80 |
-
|
81 |
-
sgBackup.toggleDaySelection = function () {
|
82 |
-
jQuery('#sg-schedule-day-of-week-select').hide();
|
83 |
-
jQuery('#sg-schedule-day-of-month-select').hide();
|
84 |
-
jQuery('#sg-schedule-month-of-year-select').hide();
|
85 |
-
}
|
86 |
-
|
87 |
-
sgBackup.updateDaysOfMonth = function () {
|
88 |
-
let year = new Date().getFullYear();
|
89 |
-
let interval = jQuery('#sg-schedule-interval').val();
|
90 |
-
let month = '';
|
91 |
-
|
92 |
-
if (interval == BG_SCHEDULE_INTERVAL_MONTHLY) {
|
93 |
-
month = new Date().getMonth() + 1;
|
94 |
-
} else {
|
95 |
-
month = parseInt(jQuery('#sg-schedule-month-of-year').val());
|
96 |
-
}
|
97 |
-
|
98 |
-
let days = sgBackup.daysInMonth(year, month);
|
99 |
-
|
100 |
-
jQuery("#sg-schedule-day-of-month option").show();
|
101 |
-
|
102 |
-
jQuery("#sg-schedule-day-of-month option").each(
|
103 |
-
function () {
|
104 |
-
if (jQuery(this).val() > days) {
|
105 |
-
jQuery(this).hide();
|
106 |
-
}
|
107 |
-
}
|
108 |
-
);
|
109 |
-
}
|
110 |
-
|
111 |
-
sgBackup.prependErrorMsg = function (alert) {
|
112 |
-
if (typeof jQuery('#sg-schedule-id').val() === 'undefined') {
|
113 |
-
jQuery('.sg-schedule-container legend').after(alert);
|
114 |
-
} else {
|
115 |
-
jQuery('#sg-modal .modal-header').prepend(alert);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
//SGSchedule AJAX callback
|
120 |
-
sgBackup.schedule = function () {
|
121 |
-
var error = [];
|
122 |
-
var scheduleForm = jQuery('form[data-type=schedule]');
|
123 |
-
|
124 |
-
//Validation
|
125 |
-
jQuery('.alert').remove();
|
126 |
-
if (jQuery('input[type=radio][name=backupType]:checked').val() == 2) {
|
127 |
-
if (jQuery('.sg-custom-option:checked').length <= 0) {
|
128 |
-
error.push(BG_SCHEDULE_STRINGS.invalidBackupOption);
|
129 |
-
}
|
130 |
-
//Check if any file is selected
|
131 |
-
if (jQuery('input[type=checkbox][name=backupFiles]:checked').length > 0) {
|
132 |
-
if (jQuery('.sg-custom-backup-files input:checkbox:checked').length <= 0) {
|
133 |
-
error.push(BG_SCHEDULE_STRINGS.invalidDirectorySelected);
|
134 |
-
}
|
135 |
-
}
|
136 |
-
}
|
137 |
-
//Check if any cloud is selected
|
138 |
-
if (jQuery('input[type=checkbox][name=backupCloud]:checked').length > 0) {
|
139 |
-
if (jQuery('.sg-custom-backup-cloud input:checkbox:checked').length <= 0) {
|
140 |
-
error.push(BG_SCHEDULE_STRINGS.invalidCloud);
|
141 |
-
}
|
142 |
-
}
|
143 |
-
//If any error show it and abort ajax
|
144 |
-
if (error.length) {
|
145 |
-
var alert = sgBackup.alertGenerator(error, 'alert-danger');
|
146 |
-
sgBackup.prependErrorMsg(alert);
|
147 |
-
sgBackup.scrollToElement('.alert');
|
148 |
-
return false;
|
149 |
-
}
|
150 |
-
|
151 |
-
//Before sending
|
152 |
-
jQuery('#sg-save-schedule').attr('disabled', 'disabled');
|
153 |
-
jQuery('#sg-save-schedule').html(BG_SCHEDULE_STRINGS.savingInProgress);
|
154 |
-
|
155 |
-
//On Success
|
156 |
-
var ajaxHandler = new sgRequestHandler('schedule', scheduleForm.serialize());
|
157 |
-
ajaxHandler.dataIsObject = false;
|
158 |
-
ajaxHandler.callback = function (response) {
|
159 |
-
jQuery('.alert').remove();
|
160 |
-
if (typeof response.success !== 'undefined') {
|
161 |
-
var alert = sgBackup.alertGenerator(BG_SCHEDULE_STRINGS.successMessage, 'alert-success');
|
162 |
-
sgBackup.prependErrorMsg(alert);
|
163 |
-
location.reload();
|
164 |
-
} else {
|
165 |
-
//if error
|
166 |
-
var alert = sgBackup.alertGenerator(response, 'alert-danger');
|
167 |
-
sgBackup.prependErrorMsg(alert);
|
168 |
-
}
|
169 |
-
|
170 |
-
//Always
|
171 |
-
jQuery('#sg-save-schedule').removeAttr('disabled', 'disabled');
|
172 |
-
jQuery('#sg-save-schedule').html(BG_SCHEDULE_STRINGS.saveButtonText);
|
173 |
-
sgBackup.scrollToElement('.alert');
|
174 |
-
};
|
175 |
-
ajaxHandler.run();
|
176 |
-
};
|
177 |
-
|
178 |
-
sgBackup.initScheduleSwitchButtons = function () {
|
179 |
-
jQuery('.sg-switch').bootstrapSwitch();
|
180 |
-
if (jQuery('#sg-backup-page-content-schedule .sg-switch').is(':checked')) {
|
181 |
-
jQuery('#sg-backup-page-content-schedule .sg-schedule-settings').show();
|
182 |
-
}
|
183 |
-
jQuery('.sg-switch').on(
|
184 |
-
'switchChange.bootstrapSwitch', function (event, state) {
|
185 |
-
var url = jQuery(this).attr('data-remote');
|
186 |
-
if (state) {
|
187 |
-
var isFeatureAvailable = new sgRequestHandler('isFeatureAvailable', {sgFeature: "SCHEDULE"});
|
188 |
-
isFeatureAvailable.callback = function (response) {
|
189 |
-
jQuery('.alert').remove();
|
190 |
-
if (typeof response.success !== 'undefined') {
|
191 |
-
//Show or Hide settings panel
|
192 |
-
jQuery('.sg-schedule-settings').fadeIn();
|
193 |
-
} else {
|
194 |
-
var alert = sgBackup.alertGenerator(response.error, 'alert-warning');
|
195 |
-
jQuery('.sg-schedule-container legend').after(alert);
|
196 |
-
jQuery('.sg-switch').bootstrapSwitch('state', false);
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
isFeatureAvailable.run();
|
201 |
-
} else {
|
202 |
-
var ajaxHandler = new sgRequestHandler('schedule', {remove: true});
|
203 |
-
ajaxHandler.run();
|
204 |
-
jQuery('.sg-schedule-settings').fadeOut();
|
205 |
-
}
|
206 |
-
}
|
207 |
-
);
|
208 |
-
};
|
209 |
-
|
210 |
-
sgBackup.initManulBackupRadioInputs = function () {
|
211 |
-
jQuery('input[type=radio][name=backupType]').off('change').on(
|
212 |
-
'change', function () {
|
213 |
-
jQuery('.sg-custom-backup').fadeToggle();
|
214 |
-
jQuery('.sg-custom-backup').children().find('input[class^=sg-custom]').removeAttr('checked');
|
215 |
-
jQuery('.sg-custom-backup-files').hide();
|
216 |
-
}
|
217 |
-
);
|
218 |
-
jQuery('input[type=checkbox][name=backupFiles], input[type=checkbox][name=backupCloud], input[type=checkbox][name=backupDatabase]').off('change').on(
|
219 |
-
'change', function () {
|
220 |
-
var sgCheckBoxWrapper = jQuery(this).closest('.checkbox').find('.sg-checkbox');
|
221 |
-
sgCheckBoxWrapper.fadeToggle();
|
222 |
-
if (jQuery(this).attr('name') == 'backupFiles') {
|
223 |
-
sgCheckBoxWrapper.find('input[type=checkbox]').attr('checked', 'checked');
|
224 |
-
}
|
225 |
-
}
|
226 |
-
);
|
227 |
-
jQuery('input[type=radio][name=backupDBType]').off('change').on(
|
228 |
-
'change', function () {
|
229 |
-
var sgCheckBoxWrapper = jQuery(this).closest('.checkbox').find('.sg-custom-backup-tables');
|
230 |
-
if (jQuery('input[type=radio][name=backupDBType]:checked').val() == '2') {
|
231 |
-
sgCheckBoxWrapper.find('input[type=checkbox]').not("[disabled]").prop('checked', true)
|
232 |
-
sgCheckBoxWrapper.fadeIn();
|
233 |
-
} else {
|
234 |
-
sgCheckBoxWrapper.fadeOut();
|
235 |
-
sgCheckBoxWrapper.find('input[type=checkbox][current="true"]').not("[disabled]").prop('checked', true)
|
236 |
-
sgCheckBoxWrapper.find('input[type=checkbox][current="false"]').prop('checked', false)
|
237 |
-
}
|
238 |
-
}
|
239 |
-
)
|
240 |
-
}
|
241 |
-
|
242 |
-
sgBackup.initManualBackupTooltips = function () {
|
243 |
-
jQuery('[for=cloud-ftp]').tooltip();
|
244 |
-
jQuery('[for=cloud-dropbox]').tooltip();
|
245 |
-
jQuery('[for=cloud-gdrive]').tooltip();
|
246 |
-
jQuery('[for=cloud-one-drive]').tooltip();
|
247 |
-
jQuery('[for=cloud-p-cloud]').tooltip();
|
248 |
-
jQuery('[for=cloud-box]').tooltip();
|
249 |
-
jQuery('[for=cloud-amazon]').tooltip();
|
250 |
-
jQuery('[for=cloud-backup-guard]').tooltip();
|
251 |
-
}
|
1 |
+
// phpcs:ignoreFile
|
2 |
+
BG_SCHEDULE_INTERVAL_HOURLY = 0;
|
3 |
+
BG_SCHEDULE_INTERVAL_DAILY = 1;
|
4 |
+
BG_SCHEDULE_INTERVAL_WEEKLY = 2;
|
5 |
+
BG_SCHEDULE_INTERVAL_MONTHLY = 3;
|
6 |
+
BG_SCHEDULE_INTERVAL_YEARLY = 4;
|
7 |
+
|
8 |
+
jQuery(document).ready(
|
9 |
+
function () {
|
10 |
+
sgBackup.initTablePagination('sg-schedule');
|
11 |
+
sgBackup.initScheduleCreation();
|
12 |
+
}
|
13 |
+
);
|
14 |
+
|
15 |
+
sgBackup.initScheduleCreation = function () {
|
16 |
+
sgBackup.initScheduleSwitchButtons();
|
17 |
+
sgBackup.initManulBackupRadioInputs();
|
18 |
+
sgBackup.initManualBackupTooltips();
|
19 |
+
sgBackup.toggleDaySelection();
|
20 |
+
sgBackup.initIntervalSelection();
|
21 |
+
}
|
22 |
+
|
23 |
+
sgBackup.removeSchedule = function (id) {
|
24 |
+
var ajaxHandler = new sgRequestHandler('schedule', {remove: true, id: id, token: BG_BACKUP_STRINGS.nonce});
|
25 |
+
|
26 |
+
if (!confirm(BG_SCHEDULE_STRINGS.confirm)) {
|
27 |
+
return false;
|
28 |
+
}
|
29 |
+
|
30 |
+
ajaxHandler.callback = function (response) {
|
31 |
+
jQuery('.alert').remove();
|
32 |
+
|
33 |
+
if (typeof response.success !== 'undefined') {
|
34 |
+
location.reload();
|
35 |
+
} else {
|
36 |
+
//if error
|
37 |
+
var alert = sgBackup.alertGenerator(BG_SCHEDULE_STRINGS.deletionError, 'alert-danger');
|
38 |
+
jQuery('.sg-schedule-container legend').after(alert);
|
39 |
+
}
|
40 |
+
|
41 |
+
sgBackup.scrollToElement('.alert');
|
42 |
+
};
|
43 |
+
ajaxHandler.run();
|
44 |
+
}
|
45 |
+
|
46 |
+
sgBackup.initIntervalSelection = function () {
|
47 |
+
if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_WEEKLY) {
|
48 |
+
jQuery('#sg-schedule-day-of-week-select').show();
|
49 |
+
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_MONTHLY) {
|
50 |
+
jQuery('#sg-schedule-day-of-month-select').show();
|
51 |
+
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_HOURLY) {
|
52 |
+
jQuery('#sg-schedule-timezone').hide();
|
53 |
+
}
|
54 |
+
|
55 |
+
jQuery('#sg-schedule-interval').on(
|
56 |
+
'change', function () {
|
57 |
+
jQuery('#sg-schedule-timezone').show();
|
58 |
+
if (jQuery(this).val() == BG_SCHEDULE_INTERVAL_WEEKLY) {
|
59 |
+
jQuery('#sg-schedule-month-of-year-select').hide();
|
60 |
+
jQuery('#sg-schedule-day-of-month-select').hide();
|
61 |
+
jQuery('#sg-schedule-day-of-week-select').show();
|
62 |
+
} else if (jQuery(this).val() == BG_SCHEDULE_INTERVAL_MONTHLY) {
|
63 |
+
jQuery('#sg-schedule-month-of-year-select').hide();
|
64 |
+
jQuery('#sg-schedule-day-of-week-select').hide();
|
65 |
+
jQuery('#sg-schedule-day-of-month-select').show();
|
66 |
+
sgBackup.updateDaysOfMonth();
|
67 |
+
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_HOURLY) {
|
68 |
+
jQuery('#sg-schedule-timezone').hide();
|
69 |
+
} else if (jQuery('#sg-schedule-interval').val() == BG_SCHEDULE_INTERVAL_DAILY) {
|
70 |
+
sgBackup.toggleDaySelection();
|
71 |
+
} else {
|
72 |
+
jQuery('#sg-schedule-month-of-year-select').show();
|
73 |
+
jQuery('#sg-schedule-day-of-week-select').hide();
|
74 |
+
jQuery('#sg-schedule-day-of-month-select').show();
|
75 |
+
sgBackup.updateDaysOfMonth();
|
76 |
+
}
|
77 |
+
}
|
78 |
+
);
|
79 |
+
}
|
80 |
+
|
81 |
+
sgBackup.toggleDaySelection = function () {
|
82 |
+
jQuery('#sg-schedule-day-of-week-select').hide();
|
83 |
+
jQuery('#sg-schedule-day-of-month-select').hide();
|
84 |
+
jQuery('#sg-schedule-month-of-year-select').hide();
|
85 |
+
}
|
86 |
+
|
87 |
+
sgBackup.updateDaysOfMonth = function () {
|
88 |
+
let year = new Date().getFullYear();
|
89 |
+
let interval = jQuery('#sg-schedule-interval').val();
|
90 |
+
let month = '';
|
91 |
+
|
92 |
+
if (interval == BG_SCHEDULE_INTERVAL_MONTHLY) {
|
93 |
+
month = new Date().getMonth() + 1;
|
94 |
+
} else {
|
95 |
+
month = parseInt(jQuery('#sg-schedule-month-of-year').val());
|
96 |
+
}
|
97 |
+
|
98 |
+
let days = sgBackup.daysInMonth(year, month);
|
99 |
+
|
100 |
+
jQuery("#sg-schedule-day-of-month option").show();
|
101 |
+
|
102 |
+
jQuery("#sg-schedule-day-of-month option").each(
|
103 |
+
function () {
|
104 |
+
if (jQuery(this).val() > days) {
|
105 |
+
jQuery(this).hide();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
);
|
109 |
+
}
|
110 |
+
|
111 |
+
sgBackup.prependErrorMsg = function (alert) {
|
112 |
+
if (typeof jQuery('#sg-schedule-id').val() === 'undefined') {
|
113 |
+
jQuery('.sg-schedule-container legend').after(alert);
|
114 |
+
} else {
|
115 |
+
jQuery('#sg-modal .modal-header').prepend(alert);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
//SGSchedule AJAX callback
|
120 |
+
sgBackup.schedule = function () {
|
121 |
+
var error = [];
|
122 |
+
var scheduleForm = jQuery('form[data-type=schedule]');
|
123 |
+
|
124 |
+
//Validation
|
125 |
+
jQuery('.alert').remove();
|
126 |
+
if (jQuery('input[type=radio][name=backupType]:checked').val() == 2) {
|
127 |
+
if (jQuery('.sg-custom-option:checked').length <= 0) {
|
128 |
+
error.push(BG_SCHEDULE_STRINGS.invalidBackupOption);
|
129 |
+
}
|
130 |
+
//Check if any file is selected
|
131 |
+
if (jQuery('input[type=checkbox][name=backupFiles]:checked').length > 0) {
|
132 |
+
if (jQuery('.sg-custom-backup-files input:checkbox:checked').length <= 0) {
|
133 |
+
error.push(BG_SCHEDULE_STRINGS.invalidDirectorySelected);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
//Check if any cloud is selected
|
138 |
+
if (jQuery('input[type=checkbox][name=backupCloud]:checked').length > 0) {
|
139 |
+
if (jQuery('.sg-custom-backup-cloud input:checkbox:checked').length <= 0) {
|
140 |
+
error.push(BG_SCHEDULE_STRINGS.invalidCloud);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
//If any error show it and abort ajax
|
144 |
+
if (error.length) {
|
145 |
+
var alert = sgBackup.alertGenerator(error, 'alert-danger');
|
146 |
+
sgBackup.prependErrorMsg(alert);
|
147 |
+
sgBackup.scrollToElement('.alert');
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
//Before sending
|
152 |
+
jQuery('#sg-save-schedule').attr('disabled', 'disabled');
|
153 |
+
jQuery('#sg-save-schedule').html(BG_SCHEDULE_STRINGS.savingInProgress);
|
154 |
+
|
155 |
+
//On Success
|
156 |
+
var ajaxHandler = new sgRequestHandler('schedule', scheduleForm.serialize() + '&token=' + BG_BACKUP_STRINGS.nonce);
|
157 |
+
ajaxHandler.dataIsObject = false;
|
158 |
+
ajaxHandler.callback = function (response) {
|
159 |
+
jQuery('.alert').remove();
|
160 |
+
if (typeof response.success !== 'undefined') {
|
161 |
+
var alert = sgBackup.alertGenerator(BG_SCHEDULE_STRINGS.successMessage, 'alert-success');
|
162 |
+
sgBackup.prependErrorMsg(alert);
|
163 |
+
location.reload();
|
164 |
+
} else {
|
165 |
+
//if error
|
166 |
+
var alert = sgBackup.alertGenerator(response, 'alert-danger');
|
167 |
+
sgBackup.prependErrorMsg(alert);
|
168 |
+
}
|
169 |
+
|
170 |
+
//Always
|
171 |
+
jQuery('#sg-save-schedule').removeAttr('disabled', 'disabled');
|
172 |
+
jQuery('#sg-save-schedule').html(BG_SCHEDULE_STRINGS.saveButtonText);
|
173 |
+
sgBackup.scrollToElement('.alert');
|
174 |
+
};
|
175 |
+
ajaxHandler.run();
|
176 |
+
};
|
177 |
+
|
178 |
+
sgBackup.initScheduleSwitchButtons = function () {
|
179 |
+
jQuery('.sg-switch').bootstrapSwitch();
|
180 |
+
if (jQuery('#sg-backup-page-content-schedule .sg-switch').is(':checked')) {
|
181 |
+
jQuery('#sg-backup-page-content-schedule .sg-schedule-settings').show();
|
182 |
+
}
|
183 |
+
jQuery('.sg-switch').on(
|
184 |
+
'switchChange.bootstrapSwitch', function (event, state) {
|
185 |
+
var url = jQuery(this).attr('data-remote');
|
186 |
+
if (state) {
|
187 |
+
var isFeatureAvailable = new sgRequestHandler('isFeatureAvailable', {sgFeature: "SCHEDULE"});
|
188 |
+
isFeatureAvailable.callback = function (response) {
|
189 |
+
jQuery('.alert').remove();
|
190 |
+
if (typeof response.success !== 'undefined') {
|
191 |
+
//Show or Hide settings panel
|
192 |
+
jQuery('.sg-schedule-settings').fadeIn();
|
193 |
+
} else {
|
194 |
+
var alert = sgBackup.alertGenerator(response.error, 'alert-warning');
|
195 |
+
jQuery('.sg-schedule-container legend').after(alert);
|
196 |
+
jQuery('.sg-switch').bootstrapSwitch('state', false);
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
isFeatureAvailable.run();
|
201 |
+
} else {
|
202 |
+
var ajaxHandler = new sgRequestHandler('schedule', {remove: true, token: BG_BACKUP_STRINGS.nonce});
|
203 |
+
ajaxHandler.run();
|
204 |
+
jQuery('.sg-schedule-settings').fadeOut();
|
205 |
+
}
|
206 |
+
}
|
207 |
+
);
|
208 |
+
};
|
209 |
+
|
210 |
+
sgBackup.initManulBackupRadioInputs = function () {
|
211 |
+
jQuery('input[type=radio][name=backupType]').off('change').on(
|
212 |
+
'change', function () {
|
213 |
+
jQuery('.sg-custom-backup').fadeToggle();
|
214 |
+
jQuery('.sg-custom-backup').children().find('input[class^=sg-custom]').removeAttr('checked');
|
215 |
+
jQuery('.sg-custom-backup-files').hide();
|
216 |
+
}
|
217 |
+
);
|
218 |
+
jQuery('input[type=checkbox][name=backupFiles], input[type=checkbox][name=backupCloud], input[type=checkbox][name=backupDatabase]').off('change').on(
|
219 |
+
'change', function () {
|
220 |
+
var sgCheckBoxWrapper = jQuery(this).closest('.checkbox').find('.sg-checkbox');
|
221 |
+
sgCheckBoxWrapper.fadeToggle();
|
222 |
+
if (jQuery(this).attr('name') == 'backupFiles') {
|
223 |
+
sgCheckBoxWrapper.find('input[type=checkbox]').attr('checked', 'checked');
|
224 |
+
}
|
225 |
+
}
|
226 |
+
);
|
227 |
+
jQuery('input[type=radio][name=backupDBType]').off('change').on(
|
228 |
+
'change', function () {
|
229 |
+
var sgCheckBoxWrapper = jQuery(this).closest('.checkbox').find('.sg-custom-backup-tables');
|
230 |
+
if (jQuery('input[type=radio][name=backupDBType]:checked').val() == '2') {
|
231 |
+
sgCheckBoxWrapper.find('input[type=checkbox]').not("[disabled]").prop('checked', true)
|
232 |
+
sgCheckBoxWrapper.fadeIn();
|
233 |
+
} else {
|
234 |
+
sgCheckBoxWrapper.fadeOut();
|
235 |
+
sgCheckBoxWrapper.find('input[type=checkbox][current="true"]').not("[disabled]").prop('checked', true)
|
236 |
+
sgCheckBoxWrapper.find('input[type=checkbox][current="false"]').prop('checked', false)
|
237 |
+
}
|
238 |
+
}
|
239 |
+
)
|
240 |
+
}
|
241 |
+
|
242 |
+
sgBackup.initManualBackupTooltips = function () {
|
243 |
+
jQuery('[for=cloud-ftp]').tooltip();
|
244 |
+
jQuery('[for=cloud-dropbox]').tooltip();
|
245 |
+
jQuery('[for=cloud-gdrive]').tooltip();
|
246 |
+
jQuery('[for=cloud-one-drive]').tooltip();
|
247 |
+
jQuery('[for=cloud-p-cloud]').tooltip();
|
248 |
+
jQuery('[for=cloud-box]').tooltip();
|
249 |
+
jQuery('[for=cloud-amazon]').tooltip();
|
250 |
+
jQuery('[for=cloud-backup-guard]').tooltip();
|
251 |
+
}
|
public/js/sgsettings.js
CHANGED
@@ -1,39 +1,38 @@
|
|
1 |
-
|
|
|
2 |
sgBackup.initGeneralSettingsSwitchButtons();
|
3 |
AMOUNT_OF_BACKUPS_TO_KEEP = jQuery("#amount-of-backups-to-keep").val();
|
4 |
sgBackup.saveInitialState();
|
5 |
});
|
6 |
|
7 |
-
window.onbeforeunload = function(){
|
8 |
var msg = 'You haven\'t saved your changes.';
|
9 |
var isDirty = false;
|
10 |
var value;
|
11 |
-
|
12 |
jQuery('.sg-settings-container :input').each(function () {
|
13 |
|
14 |
if (jQuery(this).attr('type') == 'checkbox') {
|
15 |
value = jQuery(this).prop('checked');
|
16 |
-
}
|
17 |
-
else {
|
18 |
value = jQuery(this).val();
|
19 |
}
|
20 |
|
21 |
-
if(jQuery(this).data('initialValue') != value){
|
22 |
isDirty = true;
|
23 |
}
|
24 |
});
|
25 |
|
26 |
-
if(isDirty == true){
|
27 |
return msg;
|
28 |
}
|
29 |
};
|
30 |
|
31 |
-
sgBackup.saveInitialState = function() {
|
32 |
-
jQuery(':input').each(function() {
|
33 |
if (jQuery(this).attr('type') == 'checkbox') {
|
34 |
value = jQuery(this).prop('checked');
|
35 |
-
}
|
36 |
-
else {
|
37 |
value = jQuery(this).val();
|
38 |
}
|
39 |
|
@@ -41,20 +40,19 @@ sgBackup.saveInitialState = function() {
|
|
41 |
});
|
42 |
};
|
43 |
|
44 |
-
sgBackup.initGeneralSettingsSwitchButtons = function() {
|
45 |
-
|
46 |
jQuery('.sg-switch').bootstrapSwitch();
|
47 |
|
48 |
jQuery('.sg-email-switch').on('switchChange.bootstrapSwitch', function (event, state) {
|
49 |
var url = jQuery(this).attr('data-remote');
|
50 |
if (state) {
|
51 |
var isFeatureAvailable = new sgRequestHandler('isFeatureAvailable', {sgFeature: 'NOTIFICATIONS'});
|
52 |
-
isFeatureAvailable.callback = function(response) {
|
53 |
if (typeof response.success !== 'undefined') {
|
54 |
//If switch is on
|
55 |
jQuery('.sg-general-settings').fadeToggle();
|
56 |
-
}
|
57 |
-
else {
|
58 |
jQuery('.alert').remove();
|
59 |
var alert = sgBackup.alertGenerator(response.error, 'alert-warning');
|
60 |
jQuery('.sg-settings-container legend').after(alert);
|
@@ -64,10 +62,9 @@ sgBackup.initGeneralSettingsSwitchButtons = function() {
|
|
64 |
}
|
65 |
|
66 |
isFeatureAvailable.run();
|
67 |
-
}
|
68 |
-
else {
|
69 |
var ajaxHandler = new sgRequestHandler(url, {cancel: true});
|
70 |
-
ajaxHandler.callback = function(response){
|
71 |
jQuery('.sg-user-email').remove();
|
72 |
jQuery('.sg-general-settings').hide();
|
73 |
};
|
@@ -82,7 +79,7 @@ sgBackup.initGeneralSettingsSwitchButtons = function() {
|
|
82 |
var feature = jQuery(this).attr('sgFeatureName');
|
83 |
if (feature && feature != 'NOTIFICATIONS') {
|
84 |
var isFeatureAvailable = new sgRequestHandler('isFeatureAvailable', {sgFeature: feature});
|
85 |
-
isFeatureAvailable.callback = function(response) {
|
86 |
if (state) {
|
87 |
if (typeof response.error !== 'undefined') {
|
88 |
jQuery('.alert').remove();
|
@@ -99,18 +96,18 @@ sgBackup.initGeneralSettingsSwitchButtons = function() {
|
|
99 |
});
|
100 |
};
|
101 |
|
102 |
-
sgBackup.sgsettings = function(){
|
103 |
var settingsForm = jQuery('form[data-type=sgsettings]');
|
104 |
var error = [];
|
105 |
//Validation
|
106 |
jQuery('.alert').remove();
|
107 |
|
108 |
-
if(jQuery('.sg-email-switch').is(":checked")){
|
109 |
var emails = jQuery('#sg-email').val().split(",");
|
110 |
|
111 |
-
jQuery.each(emails, function(
|
112 |
value = jQuery.trim(value);
|
113 |
-
if(!sgBackup.isValidEmailAddress(value)){
|
114 |
error.push(BG_SETTINGS_STRINGS.invalidEmailAddress);
|
115 |
}
|
116 |
});
|
@@ -125,15 +122,14 @@ sgBackup.sgsettings = function(){
|
|
125 |
var amountOfBackups = jQuery('#amount-of-backups-to-keep').val();
|
126 |
if (typeof amountOfBackups !== 'undefined' && (!jQuery.isNumeric(amountOfBackups) || amountOfBackups <= 0)) {
|
127 |
error.push(BG_SETTINGS_STRINGS.invalidRetentionNumber);
|
128 |
-
}
|
129 |
-
|
130 |
-
if (!confirm(BG_SETTINGS_STRINGS.retentionConfirmationFirstPart+' '+amountOfBackups+' '+BG_SETTINGS_STRINGS.retentionConfirmationSecondPart)) {
|
131 |
return false;
|
132 |
}
|
133 |
}
|
134 |
|
135 |
//If any error show it and abort ajax
|
136 |
-
if(error.length){
|
137 |
var alert = sgBackup.alertGenerator(error, 'alert-danger');
|
138 |
jQuery('.sg-settings-container legend').after(alert);
|
139 |
sgBackup.scrollToElement('.alert');
|
@@ -142,43 +138,42 @@ sgBackup.sgsettings = function(){
|
|
142 |
|
143 |
//Before sending
|
144 |
var userEmail = jQuery('#sg-email').val();
|
145 |
-
jQuery('#sg-save-settings').attr('disabled','disabled');
|
146 |
jQuery('#sg-save-settings').html(BG_SETTINGS_STRINGS.savingInProgress);
|
147 |
|
148 |
//On Success
|
149 |
-
var ajaxHandler = new sgRequestHandler('settings', settingsForm.serialize());
|
150 |
ajaxHandler.dataIsObject = false;
|
151 |
-
ajaxHandler.callback = function(response){
|
152 |
jQuery('.alert').remove();
|
153 |
-
if(typeof response.success !== 'undefined'){
|
154 |
var alert = sgBackup.alertGenerator(BG_SETTINGS_STRINGS.successMessage, 'alert-success');
|
155 |
jQuery('.sg-settings-container legend').after(alert);
|
156 |
sgBackup.addUserInfo(userEmail);
|
157 |
//jQuery('.sg-switch').bootstrapSwitch('state', true, true);
|
158 |
jQuery('.sg-general-settings').fadeOut();
|
159 |
sgBackup.saveInitialState();
|
160 |
-
}
|
161 |
-
else{
|
162 |
//if error
|
163 |
var alert = sgBackup.alertGenerator(response, 'alert-danger');
|
164 |
jQuery('.sg-settings-container legend').after(alert);
|
165 |
}
|
166 |
|
167 |
//Always
|
168 |
-
jQuery('#sg-save-settings').removeAttr('disabled','disabled');
|
169 |
jQuery('#sg-save-settings').html(BG_SETTINGS_STRINGS.saveButtonText);
|
170 |
sgBackup.scrollToElement('.alert');
|
171 |
};
|
172 |
ajaxHandler.run();
|
173 |
};
|
174 |
|
175 |
-
sgBackup.addUserInfo = function(info){
|
176 |
jQuery('.sg-user-info .sg-helper-block').remove();
|
177 |
jQuery('.sg-user-info br').remove();
|
178 |
-
jQuery('.sg-user-info').append('<br/><span class="text-muted sg-user-email sg-helper-block">'+info+'</span>');
|
179 |
};
|
180 |
|
181 |
-
sgBackup.isValidEmailAddress = function(emailAddress) {
|
182 |
var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,10}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
|
183 |
return pattern.test(emailAddress);
|
184 |
}
|
1 |
+
// phpcs:ignoreFile
|
2 |
+
jQuery(document).ready(function () {
|
3 |
sgBackup.initGeneralSettingsSwitchButtons();
|
4 |
AMOUNT_OF_BACKUPS_TO_KEEP = jQuery("#amount-of-backups-to-keep").val();
|
5 |
sgBackup.saveInitialState();
|
6 |
});
|
7 |
|
8 |
+
window.onbeforeunload = function () {
|
9 |
var msg = 'You haven\'t saved your changes.';
|
10 |
var isDirty = false;
|
11 |
var value;
|
12 |
+
|
13 |
jQuery('.sg-settings-container :input').each(function () {
|
14 |
|
15 |
if (jQuery(this).attr('type') == 'checkbox') {
|
16 |
value = jQuery(this).prop('checked');
|
17 |
+
} else {
|
|
|
18 |
value = jQuery(this).val();
|
19 |
}
|
20 |
|
21 |
+
if (jQuery(this).data('initialValue') != value) {
|
22 |
isDirty = true;
|
23 |
}
|
24 |
});
|
25 |
|
26 |
+
if (isDirty == true) {
|
27 |
return msg;
|
28 |
}
|
29 |
};
|
30 |
|
31 |
+
sgBackup.saveInitialState = function () {
|
32 |
+
jQuery(':input').each(function () {
|
33 |
if (jQuery(this).attr('type') == 'checkbox') {
|
34 |
value = jQuery(this).prop('checked');
|
35 |
+
} else {
|
|
|
36 |
value = jQuery(this).val();
|
37 |
}
|
38 |
|
40 |
});
|
41 |
};
|
42 |
|
43 |
+
sgBackup.initGeneralSettingsSwitchButtons = function () {
|
44 |
+
jQuery.fn.bootstrapSwitch.defaults.size = 'small';
|
45 |
jQuery('.sg-switch').bootstrapSwitch();
|
46 |
|
47 |
jQuery('.sg-email-switch').on('switchChange.bootstrapSwitch', function (event, state) {
|
48 |
var url = jQuery(this).attr('data-remote');
|
49 |
if (state) {
|
50 |
var isFeatureAvailable = new sgRequestHandler('isFeatureAvailable', {sgFeature: 'NOTIFICATIONS'});
|
51 |
+
isFeatureAvailable.callback = function (response) {
|
52 |
if (typeof response.success !== 'undefined') {
|
53 |
//If switch is on
|
54 |
jQuery('.sg-general-settings').fadeToggle();
|
55 |
+
} else {
|
|
|
56 |
jQuery('.alert').remove();
|
57 |
var alert = sgBackup.alertGenerator(response.error, 'alert-warning');
|
58 |
jQuery('.sg-settings-container legend').after(alert);
|
62 |
}
|
63 |
|
64 |
isFeatureAvailable.run();
|
65 |
+
} else {
|
|
|
66 |
var ajaxHandler = new sgRequestHandler(url, {cancel: true});
|
67 |
+
ajaxHandler.callback = function (response) {
|
68 |
jQuery('.sg-user-email').remove();
|
69 |
jQuery('.sg-general-settings').hide();
|
70 |
};
|
79 |
var feature = jQuery(this).attr('sgFeatureName');
|
80 |
if (feature && feature != 'NOTIFICATIONS') {
|
81 |
var isFeatureAvailable = new sgRequestHandler('isFeatureAvailable', {sgFeature: feature});
|
82 |
+
isFeatureAvailable.callback = function (response) {
|
83 |
if (state) {
|
84 |
if (typeof response.error !== 'undefined') {
|
85 |
jQuery('.alert').remove();
|
96 |
});
|
97 |
};
|
98 |
|
99 |
+
sgBackup.sgsettings = function () {
|
100 |
var settingsForm = jQuery('form[data-type=sgsettings]');
|
101 |
var error = [];
|
102 |
//Validation
|
103 |
jQuery('.alert').remove();
|
104 |
|
105 |
+
if (jQuery('.sg-email-switch').is(":checked")) {
|
106 |
var emails = jQuery('#sg-email').val().split(",");
|
107 |
|
108 |
+
jQuery.each(emails, function (index, value) {
|
109 |
value = jQuery.trim(value);
|
110 |
+
if (!sgBackup.isValidEmailAddress(value)) {
|
111 |
error.push(BG_SETTINGS_STRINGS.invalidEmailAddress);
|
112 |
}
|
113 |
});
|
122 |
var amountOfBackups = jQuery('#amount-of-backups-to-keep').val();
|
123 |
if (typeof amountOfBackups !== 'undefined' && (!jQuery.isNumeric(amountOfBackups) || amountOfBackups <= 0)) {
|
124 |
error.push(BG_SETTINGS_STRINGS.invalidRetentionNumber);
|
125 |
+
} else if (AMOUNT_OF_BACKUPS_TO_KEEP != amountOfBackups) {
|
126 |
+
if (!confirm(BG_SETTINGS_STRINGS.retentionConfirmationFirstPart + ' ' + amountOfBackups + ' ' + BG_SETTINGS_STRINGS.retentionConfirmationSecondPart)) {
|
|
|
127 |
return false;
|
128 |
}
|
129 |
}
|
130 |
|
131 |
//If any error show it and abort ajax
|
132 |
+
if (error.length) {
|
133 |
var alert = sgBackup.alertGenerator(error, 'alert-danger');
|
134 |
jQuery('.sg-settings-container legend').after(alert);
|
135 |
sgBackup.scrollToElement('.alert');
|
138 |
|
139 |
//Before sending
|
140 |
var userEmail = jQuery('#sg-email').val();
|
141 |
+
jQuery('#sg-save-settings').attr('disabled', 'disabled');
|
142 |
jQuery('#sg-save-settings').html(BG_SETTINGS_STRINGS.savingInProgress);
|
143 |
|
144 |
//On Success
|
145 |
+
var ajaxHandler = new sgRequestHandler('settings', settingsForm.serialize() + '&token=' + BG_BACKUP_STRINGS.nonce);
|
146 |
ajaxHandler.dataIsObject = false;
|
147 |
+
ajaxHandler.callback = function (response) {
|
148 |
jQuery('.alert').remove();
|
149 |
+
if (typeof response.success !== 'undefined') {
|
150 |
var alert = sgBackup.alertGenerator(BG_SETTINGS_STRINGS.successMessage, 'alert-success');
|
151 |
jQuery('.sg-settings-container legend').after(alert);
|
152 |
sgBackup.addUserInfo(userEmail);
|
153 |
//jQuery('.sg-switch').bootstrapSwitch('state', true, true);
|
154 |
jQuery('.sg-general-settings').fadeOut();
|
155 |
sgBackup.saveInitialState();
|
156 |
+
} else {
|
|
|
157 |
//if error
|
158 |
var alert = sgBackup.alertGenerator(response, 'alert-danger');
|
159 |
jQuery('.sg-settings-container legend').after(alert);
|
160 |
}
|
161 |
|
162 |
//Always
|
163 |
+
jQuery('#sg-save-settings').removeAttr('disabled', 'disabled');
|
164 |
jQuery('#sg-save-settings').html(BG_SETTINGS_STRINGS.saveButtonText);
|
165 |
sgBackup.scrollToElement('.alert');
|
166 |
};
|
167 |
ajaxHandler.run();
|
168 |
};
|
169 |
|
170 |
+
sgBackup.addUserInfo = function (info) {
|
171 |
jQuery('.sg-user-info .sg-helper-block').remove();
|
172 |
jQuery('.sg-user-info br').remove();
|
173 |
+
jQuery('.sg-user-info').append('<br/><span class="text-muted sg-user-email sg-helper-block">' + info + '</span>');
|
174 |
};
|
175 |
|
176 |
+
sgBackup.isValidEmailAddress = function (emailAddress) {
|
177 |
var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,10}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
|
178 |
return pattern.test(emailAddress);
|
179 |
}
|
public/settings.php
CHANGED
@@ -1,340 +1,341 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once dirname(__FILE__) . '/boot.php';
|
4 |
-
require_once SG_PUBLIC_INCLUDE_PATH . '/header.php';
|
5 |
-
$isNotificationEnabled
|
6 |
-
$userEmail
|
7 |
-
$isDeleteBackupAfterUploadEnabled = SGConfig::get('SG_DELETE_BACKUP_AFTER_UPLOAD');
|
8 |
-
$isDeleteBackupFromCloudEnabled
|
9 |
-
$isDisabelAdsEnabled
|
10 |
-
$isDownloadMode
|
11 |
-
$isAlertBeforeUpdateEnabled
|
12 |
-
$isShowStatisticsWidgetEnabled
|
13 |
-
$isReloadingsEnabled
|
14 |
-
$intervalSelectElement
|
15 |
-
'1000' => '1 second',
|
16 |
-
'2000' => '2 seconds',
|
17 |
-
'3000' => '3 seconds',
|
18 |
-
'5000' => '5 seconds',
|
19 |
-
'7000' => '7 seconds',
|
20 |
-
'10000' => '10 seconds');
|
21 |
-
$selectedInterval
|
22 |
-
|
23 |
-
$backupFileNamePrefix = SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') ? SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') : SG_BACKUP_FILE_NAME_DEFAULT_PREFIX;
|
24 |
-
$backupFileNamePrefix =
|
25 |
-
|
26 |
-
$infoIconHtml
|
27 |
-
$sgBackgroundReloadMethod
|
28 |
-
$ftpPassiveMode
|
29 |
-
$contentClassName
|
30 |
-
$savedCloudUploadChunkSize = getCloudUploadChunkSize();
|
31 |
-
$timezones
|
32 |
-
$timezone
|
33 |
-
?>
|
34 |
-
<div id="sg-backup-page-content-settings" class="sg-backup-page-content <?php echo $contentClassName; ?>">
|
35 |
-
<div class="row sg-settings-container">
|
36 |
-
<div class="col-md-12">
|
37 |
-
<form class="form-horizontal" method="post" data-sgform="ajax" data-type="sgsettings">
|
38 |
-
<fieldset>
|
39 |
-
<div><h1 class="sg-backup-page-title"><?php _backupGuardT('General settings') ?></h1></div>
|
40 |
-
<div class="form-group">
|
41 |
-
<label class="col-md-4 sg-control-label" for='sg-timezone'>
|
42 |
-
<?php _backupGuardT("Timezone") ?>
|
43 |
-
</label>
|
44 |
-
<div class="col-md-5 text-left">
|
45 |
-
<select class="form-control" id='sg-timezone' name='sg-timezone'>
|
46 |
-
<option value="UTC"<?= $timezone == 'UTC' ? ' selected' : '' ?>>(UTC+00:00) UTC</option>
|
47 |
-
<?php foreach ($timezones as $region => $timezoneText) : ?>
|
48 |
-
<option value="<?= $region ?>"<?= $timezone == $region ? ' selected' : '' ?>><?= $timezoneText[0] ?></option>
|
49 |
-
<?php endforeach; ?>
|
50 |
-
</select>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
|
54 |
-
<?php if (SGBoot::isFeatureAvailable('NOTIFICATIONS')) : ?>
|
55 |
-
<div class="form-group">
|
56 |
-
<label class="col-md-4 sg-control-label">
|
57 |
-
<?php _backupGuardT('Email notifications'); ?><?php echo $infoIconHtml; ?>
|
58 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable notifications to receive status updates about your backup/restore processes.'); ?></span>
|
59 |
-
<?php if (!empty($userEmail)) : ?>
|
60 |
-
<br/><span
|
61 |
-
class="text-muted sg-user-email sg-helper-block"><?php echo esc_html($userEmail); ?></span>
|
62 |
-
<?php endif ?>
|
63 |
-
</label>
|
64 |
-
<div class="col-md-3 text-left">
|
65 |
-
<label class="sg-switch-container">
|
66 |
-
<input type="checkbox" name="sgIsEmailNotification"
|
67 |
-
class="sg-switch sg-email-switch"
|
68 |
-
sgFeatureName="NOTIFICATIONS" <?php echo $isNotificationEnabled ? 'checked="checked"' : '' ?>
|
69 |
-
data-remote="settings">
|
70 |
-
</label>
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
<div class="sg-general-settings">
|
74 |
-
<div class="form-group">
|
75 |
-
<label class="col-md-4 sg-control-label"
|
76 |
-
for="sg-email"><?php _backupGuardT('Enter email') ?></label>
|
77 |
-
<div class="col-md-5">
|
78 |
-
<input id="sg-email" name="sgUserEmail" type="text"
|
79 |
-
placeholder="<?php _backupGuardT('You can enter multiple emails, just separate them with comma') ?>"
|
80 |
-
class="form-control input-md sg-backup-input"
|
81 |
-
value="<?php echo @$userEmail ?>">
|
82 |
-
</div>
|
83 |
-
</div>
|
84 |
-
</div>
|
85 |
-
<?php endif; ?>
|
86 |
-
<div class="form-group">
|
87 |
-
<label class="col-md-4 sg-control-label">
|
88 |
-
<?php _backupGuardT('Reloads enabled'); ?><?php echo $infoIconHtml; ?>
|
89 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable chunked backup/restore. Recommended to avoid execution timeout errors.') ?></span>
|
90 |
-
</label>
|
91 |
-
<div class="col-md-3 text-left">
|
92 |
-
<label class="sg-switch-container">
|
93 |
-
<input type="checkbox" name="backup-with-reloadings"
|
94 |
-
class="sg-switch" <?php echo $isReloadingsEnabled ? 'checked="checked"' : '' ?>>
|
95 |
-
</label>
|
96 |
-
</div>
|
97 |
-
</div>
|
98 |
-
<?php if (SGBoot::isFeatureAvailable('DELETE_LOCAL_BACKUP_AFTER_UPLOAD')) : ?>
|
99 |
-
<div class="form-group">
|
100 |
-
<label class="col-md-4 sg-control-label">
|
101 |
-
<?php _backupGuardT('Delete local backup after upload'); ?><?php echo $infoIconHtml; ?>
|
102 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Delete your local copy of backup once it is successfully uploaded to the connected cloud.') ?></span>
|
103 |
-
</label>
|
104 |
-
<div class="col-md-3 text-left">
|
105 |
-
<label class="sg-switch-container">
|
106 |
-
<input type="checkbox" name="delete-backup-after-upload"
|
107 |
-
sgFeatureName="DELETE_LOCAL_BACKUP_AFTER_UPLOAD"
|
108 |
-
class="sg-switch" <?php echo $isDeleteBackupAfterUploadEnabled ? 'checked="checked"' : '' ?>>
|
109 |
-
</label>
|
110 |
-
</div>
|
111 |
-
</div>
|
112 |
-
<?php endif; ?>
|
113 |
-
<?php if (SGBoot::isFeatureAvailable('ALERT_BEFORE_UPDATE')) : ?>
|
114 |
-
<div class="form-group">
|
115 |
-
<label class="col-md-4 sg-control-label">
|
116 |
-
<?php _backupGuardT('Alert before update'); ?><?php echo $infoIconHtml; ?>
|
117 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Receive an alert to backup you website prior to updating installed plugins.') ?></span>
|
118 |
-
</label>
|
119 |
-
<div class="col-md-3 text-left">
|
120 |
-
<label class="sg-switch-container">
|
121 |
-
<input type="checkbox" name="alert-before-update"
|
122 |
-
sgFeatureName="ALERT_BEFORE_UPDATE"
|
123 |
-
class="sg-switch" <?php echo $isAlertBeforeUpdateEnabled ? 'checked="checked"' : '' ?>>
|
124 |
-
</label>
|
125 |
-
</div>
|
126 |
-
</div>
|
127 |
-
<?php endif; ?>
|
128 |
-
<?php if (SGBoot::isFeatureAvailable('BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD')) : ?>
|
129 |
-
<div class="form-group">
|
130 |
-
<label class="col-md-4 sg-control-label">
|
131 |
-
<?php _backupGuardT('Backup deletion will also delete from cloud'); ?><?php echo $infoIconHtml; ?>
|
132 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Deleting your local copy of backup will automatically remove it from the connected cloud as well.') ?></span>
|
133 |
-
</label>
|
134 |
-
<div class="col-md-3 text-left">
|
135 |
-
<label class="sg-switch-container">
|
136 |
-
<input type="checkbox" name="delete-backup-from-cloud"
|
137 |
-
sgFeatureName="BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD"
|
138 |
-
class="sg-switch" <?php echo $isDeleteBackupFromCloudEnabled ? 'checked="checked"' : '' ?>>
|
139 |
-
</label>
|
140 |
-
</div>
|
141 |
-
</div>
|
142 |
-
<?php endif; ?>
|
143 |
-
<div class="form-group">
|
144 |
-
<label class="col-md-4 sg-control-label">
|
145 |
-
<?php _backupGuardT('Show statistics'); ?><?php echo $infoIconHtml; ?>
|
146 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Backup statistics available in the dashboard.') ?></span>
|
147 |
-
</label>
|
148 |
-
<div class="col-md-3 text-left">
|
149 |
-
<label class="sg-switch-container">
|
150 |
-
<input type="checkbox" name="show-statistics-widget"
|
151 |
-
class="sg-switch" <?php echo $isShowStatisticsWidgetEnabled ? 'checked="checked"' : '' ?>>
|
152 |
-
</label>
|
153 |
-
</div>
|
154 |
-
</div>
|
155 |
-
<?php if (SGBoot::isFeatureAvailable('FTP')) : ?>
|
156 |
-
<div class="form-group">
|
157 |
-
<label class="col-md-4 sg-control-label">
|
158 |
-
<?php _backupGuardT('FTP passive mode'); ?>
|
159 |
-
</label>
|
160 |
-
<div class="col-md-3 text-left">
|
161 |
-
<label class="sg-switch-container">
|
162 |
-
<input type="checkbox" name="ftp-passive-mode" sgFeatureName="FTP"
|
163 |
-
class="sg-switch" <?php echo $ftpPassiveMode ? 'checked="checked"' : '' ?>>
|
164 |
-
</label>
|
165 |
-
</div>
|
166 |
-
</div>
|
167 |
-
<?php endif; ?>
|
168 |
-
<?php if (SGBoot::isFeatureAvailable('MULTI_SCHEDULE')) : ?>
|
169 |
-
<div class="form-group">
|
170 |
-
<label class="col-md-4 sg-control-label">
|
171 |
-
<?php _backupGuardT('Disable ads'); ?><?php echo $infoIconHtml; ?>
|
172 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Disable advertisements inside the plugin (e.g. banners)') ?></span>
|
173 |
-
</label>
|
174 |
-
<div class="col-md-3 text-left">
|
175 |
-
<label class="sg-switch-container">
|
176 |
-
<input type="checkbox" name="sg-hide-ads" sgFeatureName="HIDE_ADS"
|
177 |
-
class="sg-switch" <?php echo $isDisabelAdsEnabled ? 'checked="checked"' : '' ?>>
|
178 |
-
</label>
|
179 |
-
</div>
|
180 |
-
</div>
|
181 |
-
<?php endif; ?>
|
182 |
-
<div class="form-group">
|
183 |
-
<label class="col-md-4 sg-control-label" for='sg-download-mode'>
|
184 |
-
<?php _backupGuardT("Download mode") ?><?php echo $infoIconHtml; ?>
|
185 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Select what technique to use for downloading the backup files.') ?></span>
|
186 |
-
</label>
|
187 |
-
<div class="col-md-5 text-left">
|
188 |
-
<select class="form-control" id='sg-download-mode' name='sg-download-mode'>
|
189 |
-
<?php if (backupGuardCheckOS() !== 'windows') : ?>
|
190 |
-
<option value="0" <?php echo $isDownloadMode === BACKUP_GUARD_DOWNLOAD_MODE_LINK ? "selected" : "" ?> >
|
191 |
-
Hard link
|
192 |
-
</option>
|
193 |
-
<?php endif; ?>
|
194 |
-
<option value="1" <?php echo $isDownloadMode == BACKUP_GUARD_DOWNLOAD_MODE_PHP ? "selected" : "" ?> >
|
195 |
-
Via PHP
|
196 |
-
</option>
|
197 |
-
<option value="2" <?php echo $isDownloadMode == BACKUP_GUARD_DOWNLOAD_MODE_SYMLINK ? "selected" : "" ?> >
|
198 |
-
Symlink
|
199 |
-
</option>
|
200 |
-
</select>
|
201 |
-
</div>
|
202 |
-
</div>
|
203 |
-
<div class="form-group">
|
204 |
-
<label class="col-md-4 sg-control-label">
|
205 |
-
<?php _backupGuardT('Send usage data'); ?><?php echo $infoIconHtml; ?>
|
206 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Allow us to receive usage data in order to improve plugin functionality') ?></span>
|
207 |
-
</label>
|
208 |
-
<div class="col-md-3 text-left">
|
209 |
-
<label class="sg-switch-container">
|
210 |
-
<input type="checkbox" name="backup-send-usage-data-status"
|
211 |
-
class="sg-switch backup-send-usage-data-status" <?php echo $allowDataCollection ? 'checked="checked"' : '' ?>>
|
212 |
-
</label>
|
213 |
-
</div>
|
214 |
-
</div>
|
215 |
-
<div class="form-group">
|
216 |
-
<label class="col-md-4 sg-control-label" for='sg-paths-to-exclude'>
|
217 |
-
<?php _backupGuardT("Exclude paths (separated by commas)") ?>
|
218 |
-
</label>
|
219 |
-
<div class="col-md-5 text-left">
|
220 |
-
<input class="form-control sg-backup-input" id='sg-paths-to-exclude'
|
221 |
-
name='sg-paths-to-exclude' type="text"
|
222 |
-
value="<?php echo SGConfig::get('SG_PATHS_TO_EXCLUDE') ? SGConfig::get('SG_PATHS_TO_EXCLUDE') : '' ?>"
|
223 |
-
placeholder="e.g. wp-content/cache, wp-content/w3tc-cache">
|
224 |
-
</div>
|
225 |
-
</div>
|
226 |
-
<div class="form-group">
|
227 |
-
<label class="col-md-4 sg-control-label" for='sg-tables-to-exclude'>
|
228 |
-
<?php _backupGuardT("Tables to exclude (separated by commas)") ?>
|
229 |
-
</label>
|
230 |
-
<div class="col-md-5 text-left">
|
231 |
-
<input class="form-control sg-backup-input" id='sg-tables-to-exclude'
|
232 |
-
name='sg-tables-to-exclude' type="text"
|
233 |
-
value="<?php echo SGConfig::get('SG_TABLES_TO_EXCLUDE') ? SGConfig::get('SG_TABLES_TO_EXCLUDE') : '' ?>"
|
234 |
-
placeholder="e.g. wp_comments, wp_commentmeta">
|
235 |
-
</div>
|
236 |
-
</div>
|
237 |
-
<?php if (SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP')) : ?>
|
238 |
-
<div class="form-group">
|
239 |
-
<label class="col-md-4 sg-control-label" for='amount-of-backups-to-keep'>
|
240 |
-
<?php _backupGuardT("Backup retention") ?><?php echo $infoIconHtml; ?>
|
241 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose number of backups to keep on the website. Each additional backup will replace the oldest backup file') ?></span>
|
242 |
-
</label>
|
243 |
-
<div class="col-md-5 text-left">
|
244 |
-
<input class="form-control sg-backup-input" id='amount-of-backups-to-keep'
|
245 |
-
name='amount-of-backups-to-keep' type="text"
|
246 |
-
value="<?php echo (int)
|
247 |
-
</div>
|
248 |
-
</div>
|
249 |
-
<?php endif; ?>
|
250 |
-
<div class="form-group">
|
251 |
-
<label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
|
252 |
-
<?php _backupGuardT("Number of rows to backup at once") ?><?php echo $infoIconHtml; ?>
|
253 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the number of row during the Databases backup in order not to overload your RAM.') ?></span>
|
254 |
-
</label>
|
255 |
-
<div class="col-md-5 text-left">
|
256 |
-
<input class="form-control sg-backup-input" id='sg-number-of-rows-to-backup'
|
257 |
-
name='sg-number-of-rows-to-backup' type="text"
|
258 |
-
value="<?php echo (int)
|
259 |
-
</div>
|
260 |
-
</div>
|
261 |
-
<div class="form-group">
|
262 |
-
<label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
|
263 |
-
<?php _backupGuardT("Upload to cloud chunk size") ?><?php echo $infoIconHtml; ?>
|
264 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Change the size of the chunk upload during backup to cloud(s).') ?></span>
|
265 |
-
</label>
|
266 |
-
<div class="col-md-5 text-left">
|
267 |
-
<select class="form-control" id='sg-upload-cloud-chunk-szie'
|
268 |
-
name='sg-upload-cloud-chunk-size'>
|
269 |
-
<option value="4" <?php echo $savedCloudUploadChunkSize == 4 ? "selected" : "" ?> >4MB
|
270 |
-
</option>
|
271 |
-
<option value="8" <?php echo $savedCloudUploadChunkSize == 8 ? "selected" : "" ?> >8MB
|
272 |
-
</option>
|
273 |
-
<option value="16" <?php echo $savedCloudUploadChunkSize == 16 ? "selected" : "" ?> >
|
274 |
-
16MB
|
275 |
-
</option>
|
276 |
-
<option value="32" <?php echo $savedCloudUploadChunkSize == 32 ? "selected" : "" ?> >
|
277 |
-
32MB
|
278 |
-
</option>
|
279 |
-
</select>
|
280 |
-
</div>
|
281 |
-
</div>
|
282 |
-
<div class="form-group">
|
283 |
-
<label class="col-md-4 sg-control-label" for='sg-background-reload-method'>
|
284 |
-
<?php _backupGuardT("Reload method") ?><?php echo $infoIconHtml; ?>
|
285 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the right PHP Library for reloads') ?></span>
|
286 |
-
</label>
|
287 |
-
<div class="col-md-5 text-left">
|
288 |
-
<select class="form-control" id='sg-background-reload-method'
|
289 |
-
name='sg-background-reload-method'>
|
290 |
-
<option value="<?php echo SG_RELOAD_METHOD_CURL ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_CURL ? "selected" : "" ?> >
|
291 |
-
Curl
|
292 |
-
</option>
|
293 |
-
<option value="<?php echo SG_RELOAD_METHOD_STREAM ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_STREAM ? "selected" : "" ?> >
|
294 |
-
Stream
|
295 |
-
</option>
|
296 |
-
<option value="<?php echo SG_RELOAD_METHOD_SOCKET ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_SOCKET ? "selected" : "" ?> >
|
297 |
-
Socket
|
298 |
-
</option>
|
299 |
-
</select>
|
300 |
-
</div>
|
301 |
-
</div>
|
302 |
-
<?php if (SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) : ?>
|
303 |
-
<div class="form-group">
|
304 |
-
<label class="col-md-4 sg-control-label">
|
305 |
-
<?php _backupGuardT('Backup file name') ?><?php echo $infoIconHtml; ?>
|
306 |
-
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Name your backups or leave to the default prefixes') ?></span>
|
307 |
-
</label>
|
308 |
-
<div class="col-md-5 text-left">
|
309 |
-
<input id="backup-file-name" name="backup-file-name" type="text"
|
310 |
-
class="form-control input-md sg-backup-input"
|
311 |
-
value="<?php echo $backupFileNamePrefix ?>" <?php echo (!SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) ? 'disabled' : '' ?>>
|
312 |
-
</div>
|
313 |
-
</div>
|
314 |
-
<?php endif; ?>
|
315 |
-
<div class="form-group">
|
316 |
-
<label class="col-md-4 sg-control-label" for="sg-email">
|
317 |
-
<?php _backupGuardT('Request frequency') ?>
|
318 |
-
</label>
|
319 |
-
<div class="col-md-5">
|
320 |
-
<?php echo selectElement($intervalSelectElement, array('id' => 'sg-ajax-interval',
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
<
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
<
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
</div>
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once dirname(__FILE__) . '/boot.php';
|
4 |
+
require_once SG_PUBLIC_INCLUDE_PATH . '/header.php';
|
5 |
+
$isNotificationEnabled = SGConfig::get('SG_NOTIFICATIONS_ENABLED');
|
6 |
+
$userEmail = SGConfig::get('SG_NOTIFICATIONS_EMAIL_ADDRESS');
|
7 |
+
$isDeleteBackupAfterUploadEnabled = SGConfig::get('SG_DELETE_BACKUP_AFTER_UPLOAD');
|
8 |
+
$isDeleteBackupFromCloudEnabled = SGConfig::get('SG_DELETE_BACKUP_FROM_CLOUD');
|
9 |
+
$isDisabelAdsEnabled = SGConfig::get('SG_DISABLE_ADS');
|
10 |
+
$isDownloadMode = SGConfig::get('SG_DOWNLOAD_MODE');
|
11 |
+
$isAlertBeforeUpdateEnabled = SGConfig::get('SG_ALERT_BEFORE_UPDATE');
|
12 |
+
$isShowStatisticsWidgetEnabled = SGConfig::get('SG_SHOW_STATISTICS_WIDGET');
|
13 |
+
$isReloadingsEnabled = SGConfig::get('SG_BACKUP_WITH_RELOADINGS');
|
14 |
+
$intervalSelectElement = array(
|
15 |
+
'1000' => '1 second',
|
16 |
+
'2000' => '2 seconds',
|
17 |
+
'3000' => '3 seconds',
|
18 |
+
'5000' => '5 seconds',
|
19 |
+
'7000' => '7 seconds',
|
20 |
+
'10000' => '10 seconds');
|
21 |
+
$selectedInterval = (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY') ? (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY') : SG_AJAX_DEFAULT_REQUEST_FREQUENCY;
|
22 |
+
|
23 |
+
$backupFileNamePrefix = SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') ? SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') : SG_BACKUP_FILE_NAME_DEFAULT_PREFIX;
|
24 |
+
$backupFileNamePrefix = esc_attr($backupFileNamePrefix);
|
25 |
+
|
26 |
+
$infoIconHtml = '<span class="dashicons dashicons-editor-help sgbg-info-icon"></span>';
|
27 |
+
$sgBackgroundReloadMethod = SGConfig::get('SG_BACKGROUND_RELOAD_METHOD');
|
28 |
+
$ftpPassiveMode = SGConfig::get('SG_FTP_PASSIVE_MODE');
|
29 |
+
$contentClassName = getBackupPageContentClassName('settings');
|
30 |
+
$savedCloudUploadChunkSize = getCloudUploadChunkSize();
|
31 |
+
$timezones = getAllTimezones();
|
32 |
+
$timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
|
33 |
+
?>
|
34 |
+
<div id="sg-backup-page-content-settings" class="sg-backup-page-content <?php echo $contentClassName; ?>">
|
35 |
+
<div class="row sg-settings-container">
|
36 |
+
<div class="col-md-12">
|
37 |
+
<form class="form-horizontal" method="post" data-sgform="ajax" data-type="sgsettings">
|
38 |
+
<fieldset>
|
39 |
+
<div><h1 class="sg-backup-page-title"><?php _backupGuardT('General settings') ?></h1></div>
|
40 |
+
<div class="form-group">
|
41 |
+
<label class="col-md-4 sg-control-label" for='sg-timezone'>
|
42 |
+
<?php _backupGuardT("Timezone") ?>
|
43 |
+
</label>
|
44 |
+
<div class="col-md-5 text-left">
|
45 |
+
<select class="form-control" id='sg-timezone' name='sg-timezone'>
|
46 |
+
<option value="UTC"<?= $timezone == 'UTC' ? ' selected' : '' ?>>(UTC+00:00) UTC</option>
|
47 |
+
<?php foreach ($timezones as $region => $timezoneText) : ?>
|
48 |
+
<option value="<?= $region ?>"<?= $timezone == $region ? ' selected' : '' ?>><?= $timezoneText[0] ?></option>
|
49 |
+
<?php endforeach; ?>
|
50 |
+
</select>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<?php if (SGBoot::isFeatureAvailable('NOTIFICATIONS')) : ?>
|
55 |
+
<div class="form-group">
|
56 |
+
<label class="col-md-4 sg-control-label">
|
57 |
+
<?php _backupGuardT('Email notifications'); ?><?php echo $infoIconHtml; ?>
|
58 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable notifications to receive status updates about your backup/restore processes.'); ?></span>
|
59 |
+
<?php if (!empty($userEmail)) : ?>
|
60 |
+
<br/><span
|
61 |
+
class="text-muted sg-user-email sg-helper-block"><?php echo esc_html($userEmail); ?></span>
|
62 |
+
<?php endif ?>
|
63 |
+
</label>
|
64 |
+
<div class="col-md-3 text-left">
|
65 |
+
<label class="sg-switch-container">
|
66 |
+
<input type="checkbox" name="sgIsEmailNotification"
|
67 |
+
class="sg-switch sg-email-switch"
|
68 |
+
sgFeatureName="NOTIFICATIONS" <?php echo $isNotificationEnabled ? 'checked="checked"' : '' ?>
|
69 |
+
data-remote="settings">
|
70 |
+
</label>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
<div class="sg-general-settings">
|
74 |
+
<div class="form-group">
|
75 |
+
<label class="col-md-4 sg-control-label"
|
76 |
+
for="sg-email"><?php _backupGuardT('Enter email') ?></label>
|
77 |
+
<div class="col-md-5">
|
78 |
+
<input id="sg-email" name="sgUserEmail" type="text"
|
79 |
+
placeholder="<?php _backupGuardT('You can enter multiple emails, just separate them with comma') ?>"
|
80 |
+
class="form-control input-md sg-backup-input"
|
81 |
+
value="<?php echo @$userEmail ?>">
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
<?php endif; ?>
|
86 |
+
<div class="form-group">
|
87 |
+
<label class="col-md-4 sg-control-label">
|
88 |
+
<?php _backupGuardT('Reloads enabled'); ?><?php echo $infoIconHtml; ?>
|
89 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable chunked backup/restore. Recommended to avoid execution timeout errors.') ?></span>
|
90 |
+
</label>
|
91 |
+
<div class="col-md-3 text-left">
|
92 |
+
<label class="sg-switch-container">
|
93 |
+
<input type="checkbox" name="backup-with-reloadings"
|
94 |
+
class="sg-switch" <?php echo $isReloadingsEnabled ? 'checked="checked"' : '' ?>>
|
95 |
+
</label>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<?php if (SGBoot::isFeatureAvailable('DELETE_LOCAL_BACKUP_AFTER_UPLOAD')) : ?>
|
99 |
+
<div class="form-group">
|
100 |
+
<label class="col-md-4 sg-control-label">
|
101 |
+
<?php _backupGuardT('Delete local backup after upload'); ?><?php echo $infoIconHtml; ?>
|
102 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Delete your local copy of backup once it is successfully uploaded to the connected cloud.') ?></span>
|
103 |
+
</label>
|
104 |
+
<div class="col-md-3 text-left">
|
105 |
+
<label class="sg-switch-container">
|
106 |
+
<input type="checkbox" name="delete-backup-after-upload"
|
107 |
+
sgFeatureName="DELETE_LOCAL_BACKUP_AFTER_UPLOAD"
|
108 |
+
class="sg-switch" <?php echo $isDeleteBackupAfterUploadEnabled ? 'checked="checked"' : '' ?>>
|
109 |
+
</label>
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<?php endif; ?>
|
113 |
+
<?php if (SGBoot::isFeatureAvailable('ALERT_BEFORE_UPDATE')) : ?>
|
114 |
+
<div class="form-group">
|
115 |
+
<label class="col-md-4 sg-control-label">
|
116 |
+
<?php _backupGuardT('Alert before update'); ?><?php echo $infoIconHtml; ?>
|
117 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Receive an alert to backup you website prior to updating installed plugins.') ?></span>
|
118 |
+
</label>
|
119 |
+
<div class="col-md-3 text-left">
|
120 |
+
<label class="sg-switch-container">
|
121 |
+
<input type="checkbox" name="alert-before-update"
|
122 |
+
sgFeatureName="ALERT_BEFORE_UPDATE"
|
123 |
+
class="sg-switch" <?php echo $isAlertBeforeUpdateEnabled ? 'checked="checked"' : '' ?>>
|
124 |
+
</label>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
<?php endif; ?>
|
128 |
+
<?php if (SGBoot::isFeatureAvailable('BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD')) : ?>
|
129 |
+
<div class="form-group">
|
130 |
+
<label class="col-md-4 sg-control-label">
|
131 |
+
<?php _backupGuardT('Backup deletion will also delete from cloud'); ?><?php echo $infoIconHtml; ?>
|
132 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Deleting your local copy of backup will automatically remove it from the connected cloud as well.') ?></span>
|
133 |
+
</label>
|
134 |
+
<div class="col-md-3 text-left">
|
135 |
+
<label class="sg-switch-container">
|
136 |
+
<input type="checkbox" name="delete-backup-from-cloud"
|
137 |
+
sgFeatureName="BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD"
|
138 |
+
class="sg-switch" <?php echo $isDeleteBackupFromCloudEnabled ? 'checked="checked"' : '' ?>>
|
139 |
+
</label>
|
140 |
+
</div>
|
141 |
+
</div>
|
142 |
+
<?php endif; ?>
|
143 |
+
<div class="form-group">
|
144 |
+
<label class="col-md-4 sg-control-label">
|
145 |
+
<?php _backupGuardT('Show statistics'); ?><?php echo $infoIconHtml; ?>
|
146 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Backup statistics available in the dashboard.') ?></span>
|
147 |
+
</label>
|
148 |
+
<div class="col-md-3 text-left">
|
149 |
+
<label class="sg-switch-container">
|
150 |
+
<input type="checkbox" name="show-statistics-widget"
|
151 |
+
class="sg-switch" <?php echo $isShowStatisticsWidgetEnabled ? 'checked="checked"' : '' ?>>
|
152 |
+
</label>
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
<?php if (SGBoot::isFeatureAvailable('FTP')) : ?>
|
156 |
+
<div class="form-group">
|
157 |
+
<label class="col-md-4 sg-control-label">
|
158 |
+
<?php _backupGuardT('FTP passive mode'); ?>
|
159 |
+
</label>
|
160 |
+
<div class="col-md-3 text-left">
|
161 |
+
<label class="sg-switch-container">
|
162 |
+
<input type="checkbox" name="ftp-passive-mode" sgFeatureName="FTP"
|
163 |
+
class="sg-switch" <?php echo $ftpPassiveMode ? 'checked="checked"' : '' ?>>
|
164 |
+
</label>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
<?php endif; ?>
|
168 |
+
<?php if (SGBoot::isFeatureAvailable('MULTI_SCHEDULE')) : ?>
|
169 |
+
<div class="form-group">
|
170 |
+
<label class="col-md-4 sg-control-label">
|
171 |
+
<?php _backupGuardT('Disable ads'); ?><?php echo $infoIconHtml; ?>
|
172 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Disable advertisements inside the plugin (e.g. banners)') ?></span>
|
173 |
+
</label>
|
174 |
+
<div class="col-md-3 text-left">
|
175 |
+
<label class="sg-switch-container">
|
176 |
+
<input type="checkbox" name="sg-hide-ads" sgFeatureName="HIDE_ADS"
|
177 |
+
class="sg-switch" <?php echo $isDisabelAdsEnabled ? 'checked="checked"' : '' ?>>
|
178 |
+
</label>
|
179 |
+
</div>
|
180 |
+
</div>
|
181 |
+
<?php endif; ?>
|
182 |
+
<div class="form-group">
|
183 |
+
<label class="col-md-4 sg-control-label" for='sg-download-mode'>
|
184 |
+
<?php _backupGuardT("Download mode") ?><?php echo $infoIconHtml; ?>
|
185 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Select what technique to use for downloading the backup files.') ?></span>
|
186 |
+
</label>
|
187 |
+
<div class="col-md-5 text-left">
|
188 |
+
<select class="form-control" id='sg-download-mode' name='sg-download-mode'>
|
189 |
+
<?php if (backupGuardCheckOS() !== 'windows') : ?>
|
190 |
+
<option value="0" <?php echo $isDownloadMode === BACKUP_GUARD_DOWNLOAD_MODE_LINK ? "selected" : "" ?> >
|
191 |
+
Hard link
|
192 |
+
</option>
|
193 |
+
<?php endif; ?>
|
194 |
+
<option value="1" <?php echo $isDownloadMode == BACKUP_GUARD_DOWNLOAD_MODE_PHP ? "selected" : "" ?> >
|
195 |
+
Via PHP
|
196 |
+
</option>
|
197 |
+
<option value="2" <?php echo $isDownloadMode == BACKUP_GUARD_DOWNLOAD_MODE_SYMLINK ? "selected" : "" ?> >
|
198 |
+
Symlink
|
199 |
+
</option>
|
200 |
+
</select>
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
<div class="form-group">
|
204 |
+
<label class="col-md-4 sg-control-label">
|
205 |
+
<?php _backupGuardT('Send usage data'); ?><?php echo $infoIconHtml; ?>
|
206 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Allow us to receive usage data in order to improve plugin functionality') ?></span>
|
207 |
+
</label>
|
208 |
+
<div class="col-md-3 text-left">
|
209 |
+
<label class="sg-switch-container">
|
210 |
+
<input type="checkbox" name="backup-send-usage-data-status"
|
211 |
+
class="sg-switch backup-send-usage-data-status" <?php echo $allowDataCollection ? 'checked="checked"' : '' ?>>
|
212 |
+
</label>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
<div class="form-group">
|
216 |
+
<label class="col-md-4 sg-control-label" for='sg-paths-to-exclude'>
|
217 |
+
<?php _backupGuardT("Exclude paths (separated by commas)") ?>
|
218 |
+
</label>
|
219 |
+
<div class="col-md-5 text-left">
|
220 |
+
<input class="form-control sg-backup-input" id='sg-paths-to-exclude'
|
221 |
+
name='sg-paths-to-exclude' type="text"
|
222 |
+
value="<?php echo SGConfig::get('SG_PATHS_TO_EXCLUDE') ? esc_attr(SGConfig::get('SG_PATHS_TO_EXCLUDE')) : '' ?>"
|
223 |
+
placeholder="e.g. wp-content/cache, wp-content/w3tc-cache">
|
224 |
+
</div>
|
225 |
+
</div>
|
226 |
+
<div class="form-group">
|
227 |
+
<label class="col-md-4 sg-control-label" for='sg-tables-to-exclude'>
|
228 |
+
<?php _backupGuardT("Tables to exclude (separated by commas)") ?>
|
229 |
+
</label>
|
230 |
+
<div class="col-md-5 text-left">
|
231 |
+
<input class="form-control sg-backup-input" id='sg-tables-to-exclude'
|
232 |
+
name='sg-tables-to-exclude' type="text"
|
233 |
+
value="<?php echo SGConfig::get('SG_TABLES_TO_EXCLUDE') ? esc_attr(SGConfig::get('SG_TABLES_TO_EXCLUDE')) : '' ?>"
|
234 |
+
placeholder="e.g. wp_comments, wp_commentmeta">
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
<?php if (SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP')) : ?>
|
238 |
+
<div class="form-group">
|
239 |
+
<label class="col-md-4 sg-control-label" for='amount-of-backups-to-keep'>
|
240 |
+
<?php _backupGuardT("Backup retention") ?><?php echo $infoIconHtml; ?>
|
241 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose number of backups to keep on the website. Each additional backup will replace the oldest backup file') ?></span>
|
242 |
+
</label>
|
243 |
+
<div class="col-md-5 text-left">
|
244 |
+
<input class="form-control sg-backup-input" id='amount-of-backups-to-keep'
|
245 |
+
name='amount-of-backups-to-keep' type="text"
|
246 |
+
value="<?php echo (int)SGConfig::get('SG_AMOUNT_OF_BACKUPS_TO_KEEP') ? (int)SGConfig::get('SG_AMOUNT_OF_BACKUPS_TO_KEEP') : SG_NUMBER_OF_BACKUPS_TO_KEEP ?>" <?php echo (!SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP')) ? 'disabled' : '' ?>>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
<?php endif; ?>
|
250 |
+
<div class="form-group">
|
251 |
+
<label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
|
252 |
+
<?php _backupGuardT("Number of rows to backup at once") ?><?php echo $infoIconHtml; ?>
|
253 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the number of row during the Databases backup in order not to overload your RAM.') ?></span>
|
254 |
+
</label>
|
255 |
+
<div class="col-md-5 text-left">
|
256 |
+
<input class="form-control sg-backup-input" id='sg-number-of-rows-to-backup'
|
257 |
+
name='sg-number-of-rows-to-backup' type="text"
|
258 |
+
value="<?php echo (int)SGConfig::get('SG_BACKUP_DATABASE_INSERT_LIMIT') ? (int)SGConfig::get('SG_BACKUP_DATABASE_INSERT_LIMIT') : SG_BACKUP_DATABASE_INSERT_LIMIT ?>">
|
259 |
+
</div>
|
260 |
+
</div>
|
261 |
+
<div class="form-group">
|
262 |
+
<label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
|
263 |
+
<?php _backupGuardT("Upload to cloud chunk size") ?><?php echo $infoIconHtml; ?>
|
264 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Change the size of the chunk upload during backup to cloud(s).') ?></span>
|
265 |
+
</label>
|
266 |
+
<div class="col-md-5 text-left">
|
267 |
+
<select class="form-control" id='sg-upload-cloud-chunk-szie'
|
268 |
+
name='sg-upload-cloud-chunk-size'>
|
269 |
+
<option value="4" <?php echo $savedCloudUploadChunkSize == 4 ? "selected" : "" ?> >4MB
|
270 |
+
</option>
|
271 |
+
<option value="8" <?php echo $savedCloudUploadChunkSize == 8 ? "selected" : "" ?> >8MB
|
272 |
+
</option>
|
273 |
+
<option value="16" <?php echo $savedCloudUploadChunkSize == 16 ? "selected" : "" ?> >
|
274 |
+
16MB
|
275 |
+
</option>
|
276 |
+
<option value="32" <?php echo $savedCloudUploadChunkSize == 32 ? "selected" : "" ?> >
|
277 |
+
32MB
|
278 |
+
</option>
|
279 |
+
</select>
|
280 |
+
</div>
|
281 |
+
</div>
|
282 |
+
<div class="form-group">
|
283 |
+
<label class="col-md-4 sg-control-label" for='sg-background-reload-method'>
|
284 |
+
<?php _backupGuardT("Reload method") ?><?php echo $infoIconHtml; ?>
|
285 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the right PHP Library for reloads') ?></span>
|
286 |
+
</label>
|
287 |
+
<div class="col-md-5 text-left">
|
288 |
+
<select class="form-control" id='sg-background-reload-method'
|
289 |
+
name='sg-background-reload-method'>
|
290 |
+
<option value="<?php echo SG_RELOAD_METHOD_CURL ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_CURL ? "selected" : "" ?> >
|
291 |
+
Curl
|
292 |
+
</option>
|
293 |
+
<option value="<?php echo SG_RELOAD_METHOD_STREAM ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_STREAM ? "selected" : "" ?> >
|
294 |
+
Stream
|
295 |
+
</option>
|
296 |
+
<option value="<?php echo SG_RELOAD_METHOD_SOCKET ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_SOCKET ? "selected" : "" ?> >
|
297 |
+
Socket
|
298 |
+
</option>
|
299 |
+
</select>
|
300 |
+
</div>
|
301 |
+
</div>
|
302 |
+
<?php if (SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) : ?>
|
303 |
+
<div class="form-group">
|
304 |
+
<label class="col-md-4 sg-control-label">
|
305 |
+
<?php _backupGuardT('Backup file name') ?><?php echo $infoIconHtml; ?>
|
306 |
+
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Name your backups or leave to the default prefixes') ?></span>
|
307 |
+
</label>
|
308 |
+
<div class="col-md-5 text-left">
|
309 |
+
<input id="backup-file-name" name="backup-file-name" type="text"
|
310 |
+
class="form-control input-md sg-backup-input"
|
311 |
+
value="<?php echo $backupFileNamePrefix ?>" <?php echo (!SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) ? 'disabled' : '' ?>>
|
312 |
+
</div>
|
313 |
+
</div>
|
314 |
+
<?php endif; ?>
|
315 |
+
<div class="form-group">
|
316 |
+
<label class="col-md-4 sg-control-label" for="sg-email">
|
317 |
+
<?php _backupGuardT('Request frequency') ?>
|
318 |
+
</label>
|
319 |
+
<div class="col-md-5">
|
320 |
+
<?php echo selectElement($intervalSelectElement, array('id' => 'sg-ajax-interval',
|
321 |
+
'name' => 'ajaxInterval', 'class' => 'form-control'), '', $selectedInterval); ?>
|
322 |
+
</div>
|
323 |
+
</div>
|
324 |
+
<div class="form-group">
|
325 |
+
<label class="col-md-4"><?php _backupGuardT('Backup destination path'); ?></label>
|
326 |
+
<div class="col-md-6">
|
327 |
+
<span><?php echo str_replace(realpath(SG_APP_ROOT_DIRECTORY) . '/', "", realpath(SG_BACKUP_DIRECTORY)); ?></span>
|
328 |
+
</div>
|
329 |
+
</div>
|
330 |
+
<div class="form-group">
|
331 |
+
<label class="col-md-4 control-label" for="button1id"></label>
|
332 |
+
<div class="col-md-5 text-right">
|
333 |
+
<button type="button" id="sg-save-settings" class="btn btn-success"
|
334 |
+
onclick="sgBackup.sgsettings();"><?php _backupGuardT('Save') ?></button>
|
335 |
+
</div>
|
336 |
+
</div>
|
337 |
+
</fieldset>
|
338 |
+
</form>
|
339 |
+
</div>
|
340 |
+
</div>
|
341 |
+
</div>
|