-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdirect-menu.php
More file actions
89 lines (84 loc) · 3.62 KB
/
Copy pathdirect-menu.php
File metadata and controls
89 lines (84 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* Direct menu registration for RestoreWP
*/
// Direct menu registration
add_action('admin_menu', function() {
if (!current_user_can('manage_options')) {
return;
}
// Add main RestoreWP menu
add_menu_page(
'RestoreWP Dashboard',
'RestoreWP',
'manage_options',
'restorewp-direct',
function() {
?>
<div class="wrap">
<div id="restorewp-admin-root" data-active-tab="export">
<div style="padding: 20px; text-align: center;">
<div class="spinner is-active" style="float: none; margin: 20px auto;"></div>
<p>Loading RestoreWP Dashboard...</p>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
// Load CSS
$('<link>')
.appendTo('head')
.attr({
type: 'text/css',
rel: 'stylesheet',
href: '<?php echo RESTOREWP_ASSETS_URL; ?>css/admin.css?v=<?php echo RESTOREWP_VERSION; ?>'
});
// Load JS
$.getScript('<?php echo RESTOREWP_ASSETS_URL; ?>js/admin.js?v=<?php echo RESTOREWP_VERSION; ?>')
.done(function() {
console.log('RestoreWP: Script loaded successfully');
if (typeof RestoreWPAdmin !== 'undefined') {
RestoreWPAdmin.init();
}
})
.fail(function() {
console.error('RestoreWP: Failed to load admin script');
$('#restorewp-admin-root').html('<div class="notice notice-error"><p>Failed to load RestoreWP dashboard. Check console for errors.</p></div>');
});
// Set up restoreWP object
window.restoreWP = {
nonce: '<?php echo wp_create_nonce(RESTOREWP_NONCE_ACTION); ?>',
ajaxUrl: '<?php echo admin_url('admin-ajax.php'); ?>',
maxFileSize: <?php echo RESTOREWP_MAX_UPLOAD_SIZE; ?>,
chunkSize: <?php echo RESTOREWP_CHUNK_SIZE; ?>,
secretKey: '<?php echo get_option(RESTOREWP_SECRET_KEY_OPTION); ?>',
strings: {
export: 'Export',
import: 'Import',
backups: 'Backups',
exportSite: 'Export Site',
importSite: 'Import Site',
manageBackups: 'Manage Backups',
uploadFile: 'Upload File',
selectFile: 'Select File',
startExport: 'Start Export',
startImport: 'Start Import',
cancel: 'Cancel',
delete: 'Delete',
download: 'Download',
restore: 'Restore',
processing: 'Processing...',
completed: 'Completed',
failed: 'Failed',
confirmDelete: 'Are you sure you want to delete this backup?',
confirmRestore: 'Are you sure you want to restore this backup? This will overwrite your current site.'
}
};
});
</script>
<?php
},
'dashicons-migrate',
21
);
}, 5);