PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/updraftplus/templates/wp-admin/settings/existing-backups-table.php

https://gitlab.com/code26/selah
PHP | 140 lines | 95 code | 34 blank | 11 comment | 32 complexity | c8044bccca9adb2f36ddf42d449e44ef MD5 | raw file
  1. <?php
  2. if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed');
  3. $accept = apply_filters('updraftplus_accept_archivename', array());
  4. if (!is_array($accept)) $accept = array();
  5. $image_folder = UPDRAFTPLUS_DIR.'/images/icons/';
  6. $image_folder_url = UPDRAFTPLUS_URL.'/images/icons/';
  7. ?>
  8. <table class="existing-backups-table">
  9. <thead>
  10. <tr style="margin-bottom: 4px;">
  11. <th class="backup-date"><?php _e('Backup date', 'updraftplus');?></th>
  12. <th class="backup-data"><?php _e('Backup data (click to download)', 'updraftplus');?></th>
  13. <th class="updraft_backup_actions"><?php _e('Actions', 'updraftplus');?></th>
  14. </tr>
  15. <tr style="height:2px; padding:1px; margin:0px;">
  16. <td colspan="4" style="margin:0; padding:0"><div style="height: 2px; background-color:#888888;">&nbsp;</div></td>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. <?php
  21. // Reverse date sort - i.e. most recent first
  22. krsort($backup_history);
  23. foreach ($backup_history as $key => $backup) {
  24. $remote_sent = (!empty($backup['service']) && ((is_array($backup['service']) && in_array('remotesend', $backup['service'])) || 'remotesend' === $backup['service'])) ? true : false;
  25. // https://core.trac.wordpress.org/ticket/25331 explains why the following line is wrong
  26. // $pretty_date = date_i18n('Y-m-d G:i',$key);
  27. // Convert to blog time zone
  28. // $pretty_date = get_date_from_gmt(gmdate('Y-m-d H:i:s', (int)$key), 'Y-m-d G:i');
  29. $pretty_date = get_date_from_gmt(gmdate('Y-m-d H:i:s', (int) $key), 'M d, Y G:i');
  30. $esc_pretty_date = esc_attr($pretty_date);
  31. $entities = '';
  32. $nonce = $backup['nonce'];
  33. $rawbackup = $updraftplus_admin->raw_backup_info($backup_history, $key, $nonce);
  34. $jobdata = $updraftplus->jobdata_getarray($nonce);
  35. $delete_button = $updraftplus_admin->delete_button($key, $nonce, $backup);
  36. $date_label = $updraftplus_admin->date_label($pretty_date, $key, $backup, $jobdata, $nonce);
  37. $log_button = $updraftplus_admin->log_button($backup);
  38. // Remote backups with no log result in useless empty rows. However, not showing anything messes up the "Existing Backups (14)" display, until we tweak that code to count differently
  39. // if ($remote_sent && !$log_button) continue;
  40. ?>
  41. <tr class="updraft_existing_backups_row updraft_existing_backups_row_<?php echo $key;?>" data-key="<?php echo $key;?>" data-nonce="<?php echo $nonce;?>">
  42. <td class="updraft_existingbackup_date " data-rawbackup="<?php echo $rawbackup;?>">
  43. <div class="backup_date_label">
  44. <?php echo $date_label;?>
  45. <?php
  46. if (!isset($backup['service'])) $backup['service'] = array();
  47. if (!is_array($backup['service'])) $backup['service'] = array($backup['service']);
  48. foreach ($backup['service'] as $service) {
  49. if ('none' === $service || '' === $service || (is_array($service) && (empty($service) || array('none') === $service || array('') === $service))) {
  50. // Do nothing
  51. } else {
  52. $image_url = file_exists($image_folder.$service.'.png') ? $image_folder_url.$service.'.png' : $image_folder_url.'folder.png';
  53. $remote_storage = ('remotesend' === $service) ? __('remote site', 'updraftplus') : $updraftplus->backup_methods[$service];
  54. ?>
  55. <img class="stored_icon" src="<?php echo esc_attr($image_url);?>" title="<?php echo esc_attr(sprintf(__('Stored at: %s', 'updraftplus'), $remote_storage));?>">
  56. <?php
  57. }
  58. }
  59. ?>
  60. </div>
  61. </td>
  62. <td><?php
  63. if ($remote_sent) {
  64. _e('Backup sent to remote site - not available for download.', 'updraftplus');
  65. if (!empty($backup['remotesend_url'])) echo '<br>'.__('Site', 'updraftplus').': '.htmlspecialchars($backup['remotesend_url']);
  66. } else {
  67. if (empty($backup['meta_foreign']) || !empty($accept[$backup['meta_foreign']]['separatedb'])) {
  68. if (isset($backup['db'])) {
  69. $entities .= '/db=0/';
  70. // Set a flag according to whether or not $backup['db'] ends in .crypt, then pick this up in the display of the decrypt field.
  71. $db = is_array($backup['db']) ? $backup['db'][0] : $backup['db'];
  72. if ($updraftplus->is_db_encrypted($db)) $entities .= '/dbcrypted=1/';
  73. echo $updraftplus_admin->download_db_button('db', $key, $esc_pretty_date, $backup, $accept);
  74. }
  75. // External databases
  76. foreach ($backup as $bkey => $binfo) {
  77. if ('db' == $bkey || 'db' != substr($bkey, 0, 2) || '-size' == substr($bkey, -5, 5)) continue;
  78. echo $updraftplus_admin->download_db_button($bkey, $key, $esc_pretty_date, $backup);
  79. }
  80. } else {
  81. // Foreign without separate db
  82. $entities = '/db=0/meta_foreign=1/';
  83. }
  84. if (!empty($backup['meta_foreign']) && !empty($accept[$backup['meta_foreign']]) && !empty($accept[$backup['meta_foreign']]['separatedb'])) {
  85. $entities .= '/meta_foreign=2/';
  86. }
  87. echo $updraftplus_admin->download_buttons($backup, $key, $accept, $entities, $esc_pretty_date);
  88. }
  89. ?>
  90. </td>
  91. <td class="before-restore-button">
  92. <?php
  93. echo $updraftplus_admin->restore_button($backup, $key, $pretty_date, $entities);
  94. echo $delete_button;
  95. if (empty($backup['meta_foreign'])) echo $log_button;
  96. ?>
  97. </td>
  98. </tr>
  99. <tr style="height:2px; padding:1px; margin:0px;">
  100. <td colspan="4" style="margin:0; padding:0">
  101. <div style="height: 2px; background-color:#aaaaaa;">&nbsp;</div>
  102. </td>
  103. </tr>
  104. <?php } ?>
  105. </tbody>
  106. </table>