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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
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
|
<?php if (!defined('ABSPATH')) { exit; } $backupDirs = array('uploads.zip','plugins.zip','themes.zip','others.zip','db.sql.gz'); $upload_dir = wp_upload_dir(); $backup_dirname = $upload_dir['basedir'].'/wp-file-manager-pro/fm_backup/'; $backup_baseurl = $upload_dir['baseurl'].'/wp-file-manager-pro/fm_backup/'; global $wpdb; $fmdb = $wpdb->prefix.'wpfm_backup'; $backups = $wpdb->get_results("select * from ".$fmdb." order by id desc"); ?> <style> .wrap.restore-sec { background: #fff; padding: 25px; border: 1px #dddddd solid; margin-top:20px; } .wrap.restore-sec .title { border-bottom: 1px #dddddd solid; padding-bottom: 15px; } .wrap.restore-sec .title h3 { padding: 0px; margin: 0px; color: #000; font-size: 22px; font-weight: 700; } .schedule-back{ padding:35px 0px; border-bottom: 1px #ddd solid; } .schedule-back::after{ content:""; display:table; clear:both; } .schedule-back .files{ width:50%; float:left; margin-bottom: 20px; margin-top: 15px } .schedule-back .files .finner::after{ content:""; display:table; clear:both; } .schedule-back .files h4 { font-weight: bold; font-size: 16px; margin-bottom: 10px; font-family: sans-serif; } .schedule-back .files p { font-size: 14px; } .schedule-back .files .backup_btn{ background: #267ddd; color: #fff; padding: 12px 20px; text-decoration: none; border-radius: 3px; font-size: 16px; float: left; margin-top: 20px; font-weight:500; }
.schedule-back .well { width: 50%; background: #f1f1f1; clear: both; padding: 15px; border-radius: 5px; border: 1px #ddd solid; font-size: 14px; } .log-message{ padding:40px 0px; border-bottom: 1px #ddd solid; clear:both; } .log-message p{ background: #f4f4f4; padding: 12px 20px; border-radius: 3px; margin-top: 25px; margin-bottom: 0px; } .existing-back{ padding-top:40px; padding-bottom:20px; } .existing-back h3{ margin:0px; padding:0px; font-size: 22px; font-weight: 700; margin-bottom: 20px } .existing-back h3 span{ background: #0e6bb7; font-size: 14px; font-weight: 500; color: #fff; width: 30px !important; display: inline-block; text-align: center; margin-left: 10px; padding: 2px; border-radius: 10px; } strong { font-weight: 700; } p{ font-size:14px; } .existing-back p a{ text-decoration: none; } .existing-back p{ margin:10px 0px; }
.backup-main{ border:1px #ddd solid; padding:10px; font-weight:bold; } .backup-main .backup-date{ width: 230px; display:inline-block; /*float: left;*/ position: relative; } .backup-main input[type=checkbox]{ /*position: absolute; top: 15%;*/ } .backup-main .backup-date span{ /* display: block; padding-left: 25px;*/ } .database-sec{ border: 1px #ddd solid; padding: 15px 10px; font-weight: bold; border-top:0px !important; background:#f4f4f4; } .database-sec::after{ content:""; dispaly:table; clear:both; } .database-sec .backup-date { width: 230px; display: inline-block; /*float: left;*/ position: relative; vertical-align: middle; } .database-sec input[type=checkbox]{ /*position: absolute; top: 15%;*/ } .database-sec .backup-date span{ /*display: block; padding-left: 25%;*/ } .database-sec a { color: #404040; text-decoration: none; background: #fff; padding: 7px 15px; border-radius: 5px; border: 1px #ddd solid; font-size: 12px; display: inline-block; margin-bottom: 3px; } .database-sec a:hover{ color: #404040; } .action-sec a{ color: #404040; text-decoration: none; background: #fff; padding: 7px 15px; margin-left: 10px; border-radius: 5px; border: 1px #ddd solid; font-weight: bold; } .action-sec { margin-top: 30px; margin-bottom: 20px; } .action-sec strong { margin-right: 15px; } .action-sec i { font-size: 14px; color: #999; margin-left: 15px; } .light-back{ background:#f4f4f4 !important; color:#898989 !important; } .fm_open_files_options{ border:1px solid #ddd; clear: both; padding: 20px; margin-top: 20px; position:relative; /* display:none; */ } .double-col li{ list-style:none; margin:0px; } .double-col::after{ content:""; display:table; clear:both; } .double-col .inner-col-wrap{ margin-bottom:20px; } .double-col h4{ margin: 0px 0px 17px; font-size: 16px; font-weight: bold; } .double-col .inner-col-wrap::after{ content:""; display:table; clear:both; } .double-col .inner-col-half .colmn-div3{ float: left; width: calc(33.3333% - 20px); margin-right: 20px; } .double-col .inner-col-half .backup_btn { background: #0e6bb7; color: #fff; border: none; padding: 10px 12px; border-radius: 3px; cursor: pointer; } .fm_open_files_options::before{ content:""; position: absolute; top: -9px; left: 20px; right: 0; width: 15px; height: 15px; transform: rotate(-135deg); -webkit-transform: rotate(-135deg); -moz-transform: rotate(-135deg); -o-transform: rotate(-135deg); -ms-transform: rotate(-135deg); border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; background: #fff; }
/* All pop-ups css*/ .fmbkp_console_popup, .restore_backup_popup, .dlt_backup_popup, .dlt_success_popup{ position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: none; background: rgba(0,0,0,0.5); z-index: 9999; } .fmbkp_console_popup_tbl, .restore_backup_popup_tbl, .dlt_backup_popup_tbl, .dlt_success_popup_tbl{ display:table; width:100%; height:100%; } .fmbkp_console_popup_cel, .restore_backup_popup_cel, .dlt_backup_popup_cel, .dlt_success_popup_cel{ display:table-cell; vertical-align:middle; } .fmbkp_console_popup_inner, .restore_backup_popup_inner, .dlt_backup_popup_inner, .dlt_success_popup_inner{ max-width: 450px; margin: 0 auto; background: #fff; position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,.5); } .fmbkp_console_popup_inner, .restore_backup_popup_inner{ border-bottom: 10px solid #0e6bb7; } .dlt_backup_popup_inner{ border-bottom: 10px solid #de524b; } .dlt_success_popup_inner{ border-bottom: 10px solid green; } .fmbkp_console_popup_inner .close_fm_console , .close_restore_backup, .close_dlt_backup, .close_dlt_success { position: absolute; color: #fff; text-decoration: none; right: 20px; font-size: 30px; top: 20px; } .schedule-back h3{ margin: 0px; padding: 25px 20px; font-size: 22px; font-weight: 700; border-bottom: 1px solid #e5e5e5; text-align: center; background: #0e6bb7; color: #fff; } .schedule-back .dlt_backup_popup h3{ background: #de524b; } .schedule-back .dlt_success_popup h3{ background: green; } .log-message h3{ margin:0px; padding:0px; font-size: 22px; font-weight: 700; } .restore_btn_wrap, .dlt_btn_wrap, .dlt_success_wrap{ padding: 20px 20px 30px; text-align: center; } .backup_btn_common{ border: none; width: 76px; line-height: 30px; padding: 0px; color: #fff; border-radius: 3px; cursor:pointer; } .restore_cancel, .dlt_cancel{ background: #de524b; } .restore_confirmed, .dlt_btn_wrap .dlt_confirmed{ background: #156bb7; } .dlt_confirmed_success{ background: green; } /**/ #fmbkp_console { clear: both; color: #fff; padding-bottom: 15px; } #fmbkp_console .fm_console_success{ color: green; } #fmbkp_console .fm_console_log_pop{ margin: 0px; margin-bottom: 15px; padding: 25px 20px; font-size: 22px; color: #fff; font-weight: 700; border-bottom: 1px solid #e5e5e5; text-align: left; background: #0e6bb7; }
#fmbkp_console p{ padding: 10px 20px; margin: 0px; color: #444; } #fmbkp_console p.backup_wait{ margin: 0px; margin-bottom: 15px; padding: 25px 20px; font-size: 22px; line-height: 18px; color: #fff; font-weight: 700; border-bottom: 1px solid #e5e5e5; text-align: left; background: #0e6bb7; } #fmbkp_console .fm_console_error { color: red; } .no_backup { text-align: center; color: #fe0505; padding: 15px; margin: 0; font-size: 18px; margin-top: 20px; } .fmbkp_console_loader img { width: 70px; height: 20px; } .backup-main::after{ content:""; display:table; clear:both; } .bck_action { /* float: left; */ width: calc(100% - 495px); display: inline-block; vertical-align: middle; } .action_ele { /* float: left; */ width: 252px; display: inline-block; vertical-align: middle; } .database-sec::after{ content:""; display:table; clear:both; } .exitBackBtn{ border: none; padding: 7px 15px; cursor: pointer; border-radius:5px; color: #fff; margin-bottom: 3px; } .restore_btn{ background: #0e6bb7; } .del_btn{ background: #de524c; } .log_btn{ background: #fff; color: #404040; border:1px solid #ddd;
} .log_msg_align_center { text-align: center; } .disabled_btn { cursor: default; pointer-events: none; background: #ddd; color: #fff; } </style> <div class="wrap restore-sec"> <div class="title"> <h3> <?php _e('WP File Manager - Backup/Restore', 'wp-file-manager'); ?></h3> </div> <div class="schedule-back"> <!-- <h3><?php //_e('Backup Options:', 'wp-file-manager'); ?></h3> --> <div class="double-col"> <h4><?php _e('Backup Options:', 'wp-file-manager'); ?></h4> <div class="inner-col-wrap"> <div class="inner-col-half"> <div class="colmn-div3"> <input type="checkbox" name="fm_bkp_database" id="fm_bkp_database" value="5" checked="checked"> <?php _e('Database Backup', 'wp-file-manager'); ?> </div> <div class="colmn-div3"> <input type="checkbox" name="fm_bkp_files" id="fm_bkp_files" value="files" checked="checked"> <a href="javascript:void(0)" id="fm_open_files_option"><?php _e('Files Backup', 'wp-file-manager'); ?></a> <div id="fm_open_files_options" class="fm_open_files_options"> <li><input type="checkbox" id="fm_bkp_plugins" name="fm_bkp_plugins" value="1" checked="checked"><?php _e('Plugins', 'wp-file-manager'); ?></li> <li><input type="checkbox" id="fm_bkp_themes" name="fm_bkp_themes" value="2" checked="checked"><?php _e('Themes', 'wp-file-manager'); ?></li> <li><input type="checkbox" id="fm_bkp_uploads" name="fm_bkp_uploads" value="3" checked="checked"><?php _e('Uploads', 'wp-file-manager'); ?></li> <li><input type="checkbox" id="fm_bkp_other" name="fm_bkp_other" value="4" checked="checked"><?php _e('Any other directories found inside wp-content', 'wp-file-manager'); ?></li> </div> </div> <div class="colmn-div3 inner-col-half"> <button id="wpfm-backupnow-button" type="button" class="backup_btn"><?php _e('Backup Now', 'wp-file-manager'); ?></button> </div> </div> </div> </div> <div class="double-col"> <div class="well"> <b><?php _e('Time now', 'wp-file-manager'); ?></b>: <?php echo date('D, F d, Y H:i');?> </div> </div>
<div class="dlt_success_popup"> <div class="dlt_success_popup_tbl"> <div class="dlt_success_popup_cel"> <div class="dlt_success_popup_inner"> <a href="javascript:void(0)" class="close_dlt_success">×</a> <div id="dlt_success_success"> <h3><?php _e('Success', 'wp-file-manager'); ?></h3> <div class="dlt_success_wrap"> <p><?php _e('Backup successfully deleted', 'wp-file-manager'); ?></p> <button class="dlt_confirmed_success backup_btn_common"><?php _e('Ok', 'wp-file-manager'); ?></button> </div> </div> </div><!--dlt_success_popup_inner--> </div> </div> </div> <!--dlt_success_popup-->
<div class="dlt_backup_popup"> <div class="dlt_backup_popup_tbl"> <div class="dlt_backup_popup_cel"> <div class="dlt_backup_popup_inner"> <a href="javascript:void(0)" class="close_dlt_backup">×</a> <div id="dlt_backup"> <h3><?php _e('DELETE FILES', 'wp-file-manager'); ?></h3> <div class="dlt_btn_wrap"> <p><?php _e('Are you sure you want to delete this backup?', 'wp-file-manager'); ?></p> <button class="dlt_cancel backup_btn_common"><?php _e('Cancel', 'wp-file-manager'); ?></button> <button class="dlt_confirmed backup_btn_common"><?php _e('Confirm', 'wp-file-manager'); ?></button> </div> </div> </div><!--dlt_backup_popup_inner--> </div> </div> </div> <!--dlt_backup_popup-->
<div class="restore_backup_popup"> <div class="restore_backup_popup_tbl"> <div class="restore_backup_popup_cel"> <div class="restore_backup_popup_inner"> <a href="javascript:void(0)" class="close_restore_backup">×</a> <div id="restore_backup"> <h3><?php _e('RESTORE FILES', 'wp-file-manager'); ?></h3> <div class="restore_btn_wrap"> <p><?php _e('Are you sure you want to restore this backup?', 'wp-file-manager'); ?></p> <button class="restore_cancel backup_btn_common"><?php _e('Cancel', 'wp-file-manager'); ?></button> <button class="restore_confirmed backup_btn_common"><?php _e('Confirm', 'wp-file-manager'); ?></button> </div> </div> </div><!--restore_backup_popup_inner--> </div> </div> </div> <!--restore_backup_popup-->
<div class="fmbkp_console_popup"> <div class="fmbkp_console_popup_tbl"> <div class="fmbkp_console_popup_cel"> <div class="fmbkp_console_popup_inner"> <a href="javascript:void(0)" class="close_fm_console">×</a> <div id="fmbkp_console"> </div> <div class="fmbkp_console_loader"> <img src="<?php echo plugins_url('images/loader-fm-console.gif', dirname(__FILE__)); ?>"/> </div> </div><!--fmbkp_console_popup_inner--> </div> </div> </div> <!--fmbkp_console_popup--> </div> <div class="log-message"> <h3><?php _e('Last Log Message', 'wp-file-manager'); ?></h3> <p> <?php if(isset($backups) && !empty($backups)) { ?> <?php _e('The backup apparently succeeded and is now complete', 'wp-file-manager'); ?> (<?php echo $backups[0]->backup_date;?>) <?php } else { ?> <?php _e('No log message', 'wp-file-manager'); ?> <?php } ?> </p> </div> <div class="existing-back"> <h3><?php _e('Existing Backups', 'wp-file-manager'); ?> <span><?php echo count($backups);?></span> </h3> <!--p><strong> More tasks: </strong> <a href="#">upload backup files</a> | <a href="#">Rescan local folder for new backup sets </a> | <a href="#">Rescan remote storage</a></p--> </div> <div class="backup-main"> <div class="backup-date"> <input type="checkbox" class="bkpchkCheckAll"> <span> <?php _e('Backup Date', 'wp-file-manager'); ?> </span> </div> <div class="download bck_action"> <span> <?php _e('Backup data (click to download)', 'wp-file-manager'); ?></span> </div> <div class="action_ele"> <span> <?php _e('Action', 'wp-file-manager'); ?></span> </div> </div>
<?php if(isset($backups) && !empty($backups)) { $count = 1; $todayDate = date('Y-m-d'); $todayDate = strtotime($todayDate); foreach($backups as $backup) { $backupNameExp = $backup->backup_date; $compareDate = date("Y-m-d", strtotime($backupNameExp)); $compareDate = strtotime($compareDate); $backupName = date("M d, Y H:i", strtotime($backupNameExp)); ?> <div class="database-sec <?php echo($count++%2 == 0) ? 'even' : 'odd'?>"> <div class="backup-date"> <input type="checkbox" value="<?php echo $backup->id;?>" name="backupids[]" class="backupids"> <span><?php echo $backupName; ?> <?php echo ($todayDate == $compareDate) ? '(Today)' : '';?> </span> </div> <div class="download bck_action"> <?php foreach($backupDirs as $backupDir) { $bkpName = $backup->backup_name.'-'.$backupDir; $dir = $backup_dirname.$bkpName; if(file_exists($dir)) { if($backupDir == 'db.sql.gz') { $dirName = 'Database'; } else { $dirName = str_replace('.zip','',$backupDir); } $size = filesize($dir); ?> <a href="<?php echo $backup_baseurl.$bkpName;?>"><?php echo ucfirst($dirName); ?> (<?php echo $this->formatSizeUnits($size); ?>)</a> <?php } } ?> </div> <div class="action_ele"> <button class="exitBackBtn restore_btn bkpRestoreID" id="<?php echo $backup->id; ?>"><?php _e('Restore', 'wp-file-manager'); ?></button> <button class="exitBackBtn del_btn bkpDeleteID" id="<?php echo $backup->id; ?>"><?php _e('Delete', 'wp-file-manager'); ?></button> <button class="exitBackBtn log_btn bkpViewLog" id="<?php echo $backup->id; ?>"><?php _e('View Log', 'wp-file-manager'); ?></button> </div> </div> <?php } ?> <?php } else { ?> <p class="no_backup"><?php _e('Currently no backups found.', 'wp-file-manager'); ?></p> <?php } ?> <div class="action-sec"> <strong> <?php _e('Actions upon selected backups', 'wp-file-manager'); ?></strong> <button class="exitBackBtn bkpDelete del_btn disabled_btn"><?php _e('Delete', 'wp-file-manager'); ?></button> <button class="exitBackBtn bkpCheckAll restore_btn"><?php _e('Select All', 'wp-file-manager'); ?></button> <button class="exitBackBtn bkpUnCheckAll log_btn disabled_btn"><?php _e('Deselect', 'wp-file-manager'); ?></button> </div> <p><i><?php _e('Note: Backup files will be under <code>/wp-content/uploads/wp-file-manager-pro/fm_backup</code>', 'wp-file-manager'); ?></i></p> </div> <?php $wpfmbackup = wp_create_nonce( 'wpfmbackup' ); ?> <script> jQuery(document).ready(function(){ var ajax_url = "<?php echo admin_url('admin-ajax.php')?>"; jQuery("#wpfm-backupnow-button").click(function(){ var fm_bkp_database = jQuery('#fm_bkp_database').prop('checked'); var fm_bkp_files = jQuery('#fm_bkp_files').prop('checked'); var fm_bkp_plugins = jQuery('#fm_bkp_plugins').prop('checked'); var fm_bkp_themes = jQuery('#fm_bkp_themes').prop('checked'); var fm_bkp_uploads = jQuery('#fm_bkp_uploads').prop('checked'); var fm_bkp_other = jQuery('#fm_bkp_other').prop('checked'); var fm_bkp_id = ''; // empty jQuery('.fmbkp_console_popup').show(); jQuery('#fmbkp_console').show().html('<p class="backup_wait">Backup is running, please wait...</p>'); wp_fm_backup(ajax_url, fm_bkp_database,fm_bkp_files,fm_bkp_plugins,fm_bkp_themes,fm_bkp_uploads,fm_bkp_other,fm_bkp_id); }); function wp_fm_backup(ajax_url, fm_bkp_database,fm_bkp_files,fm_bkp_plugins,fm_bkp_themes,fm_bkp_uploads,fm_bkp_other,fm_bkp_id){ jQuery.ajax({ url : ajax_url, type : 'post', data : { action : 'mk_file_manager_backup', database : fm_bkp_database, files: fm_bkp_files, plugins: fm_bkp_plugins, themes: fm_bkp_themes, uploads: fm_bkp_uploads, others: fm_bkp_other, bkpid: fm_bkp_id, nonce: '<?php echo $wpfmbackup;?>' }, success : function( response ) { var res = JSON.parse(response); console.log(res); var next_step = res.step; jQuery('.fmbkp_console_popup').show(); if(next_step == '0') { jQuery('.fmbkp_console_loader').hide(); jQuery('#fmbkp_console').show().append('<p>> '+res.msg+'</p>'); location.reload(); } else { jQuery('#fmbkp_console').show().append('<p>> '+res.msg+'</p>'); wp_fm_backup(ajax_url,res.database,res.files,res.plugins,res.themes,res.uploads,res.others,res.bkpid); } } }); }
// select all -> backups jQuery(".bkpchkCheckAll").click(function () { jQuery(".backupids").prop('checked', jQuery(this).prop('checked')); if(jQuery(this).prop('checked')) { jQuery('.bkpDelete,.bkpUnCheckAll').removeClass('disabled_btn'); jQuery('.bkpCheckAll').addClass('disabled_btn'); } else { jQuery('.bkpDelete,.bkpUnCheckAll').addClass('disabled_btn'); jQuery('.bkpCheckAll').removeClass('disabled_btn'); } }); jQuery(".bkpCheckAll").click(function () { jQuery(".backupids,.bkpchkCheckAll").prop('checked', true); jQuery('.bkpDelete,.bkpUnCheckAll').removeClass('disabled_btn'); jQuery(this).addClass('disabled_btn'); }); jQuery(".bkpUnCheckAll").click(function () { jQuery(".backupids,.bkpchkCheckAll").prop('checked', false); jQuery('.bkpDelete,.bkpUnCheckAll').addClass('disabled_btn'); jQuery('.bkpCheckAll').removeClass('disabled_btn'); }); // for toggle backup options jQuery("#fm_open_files_option").click(function () { jQuery("#fm_open_files_options").slideToggle(); }); //close console popup jQuery(".close_fm_console").click(function () { jQuery(".fmbkp_console_popup").hide(); });
// on delete - ajax jQuery(".bkpDelete").click(function () { var delarr = new Array();
jQuery(".backupids").each(function () { if(jQuery(this).is(':checked')) { delarr.push(jQuery(this).val()); } }); //each
if(delarr == '') { alert('Select backups to delete!'); } else { var r = confirm("Are you sure want to remove selected backups?") if (r == true) { jQuery.ajax({ type: "POST", url: ajax_url, data: { action : 'mk_file_manager_backup_remove', delarr: delarr, nonce: '<?php echo wp_create_nonce( 'wpfmbackupremove' );?>' }, cache: false,
success: function(response) { alert(response); location.reload(); } });//ajax } } }); //click
//open DELETE popup jQuery('.bkpDeleteID').on("click",function(){ // alert("ewf"); jQuery(".dlt_backup_popup").show(); var bkpId = jQuery(this).attr('id'); jQuery('.dlt_confirmed').attr("id", bkpId); }); //close DELETE popup jQuery(".close_dlt_backup, .dlt_cancel").click(function () { jQuery(".dlt_backup_popup").hide(); }); // on delete - ajax jQuery(".dlt_confirmed").click(function () { var bkpId = jQuery(this).attr('id') jQuery.ajax({ type: "POST", url: ajax_url, data: { action : 'mk_file_manager_single_backup_remove', id: bkpId, nonce: '<?php echo wp_create_nonce( 'wpfmbackupremove' );?>' }, cache: false,
success: function(response) { if(response == "Backup removed successfully!"){ jQuery(".dlt_backup_popup").hide(); jQuery(".dlt_success_popup").show(); } } });//ajax }); //click jQuery(".close_dlt_success, .dlt_confirmed_success").click(function () { jQuery(".dlt_success_popup").hide(); location.reload(); });
// backup - ajax jQuery(".bkpViewLog").click(function () { jQuery('.fmbkp_console_popup').show(); jQuery('#fmbkp_console').html(''); var bkpId = jQuery(this).attr('id') jQuery.ajax({ type: "POST", url: ajax_url, data: { action : 'mk_file_manager_single_backup_logs', id: bkpId, nonce: '<?php echo wp_create_nonce( 'wpfmbackuplogs' );?>' }, cache: false,
success: function(response) { jQuery('.fmbkp_console_loader').hide(); jQuery('#fmbkp_console').show().html(response); } });//ajax }); //click
//open restore popup jQuery('.bkpRestoreID').on("click",function(){ // alert("ewf"); jQuery(".restore_backup_popup").show(); var bkpId = jQuery(this).attr('id'); jQuery('.restore_confirmed').attr("id", bkpId); }); //close restore popup jQuery(".close_restore_backup, .restore_cancel").click(function () { jQuery(".restore_backup_popup").hide(); }); // on delete - ajax jQuery(".restore_confirmed").click(function () { var bkpId = jQuery(this).attr('id'); jQuery.ajax({ type: "POST", url: ajax_url, data: { action : 'mk_file_manager_single_backup_restore', id: bkpId, nonce: '<?php echo wp_create_nonce( 'wpfmbackuprestore' );?>' }, cache: false,
success: function(response) { alert(response); location.reload(); } });//ajax
}); //click
}); </script>
|