backup-ongoing.php
3 weeks ago
backup_controller.php
3 weeks ago
backups-table-header.php
3 weeks ago
backups-under-table.php
3 weeks ago
before-update-backup-errors.php
3 weeks ago
cloud-backup-notice.php
3 weeks ago
email-errors.php
3 weeks ago
ping-server-is-not-working-notice.php
3 weeks ago
plugins-auto-update-notice.php
3 weeks ago
quota-errors.php
3 weeks ago
security-plugins-warning.php
3 weeks ago
site-is-local-notice.php
3 weeks ago
stream-backup-notice.php
3 weeks ago
super-quick-migration.php
3 weeks ago
support-chat.php
3 weeks ago
upload-backup.php
3 weeks ago
backup_controller.php
230 lines
| 1 | <?php |
| 2 | |
| 3 | // Namespace |
| 4 | namespace BMI\Plugin\Dashboard; |
| 5 | |
| 6 | // Exit on direct access |
| 7 | if (!defined('ABSPATH')) exit; |
| 8 | |
| 9 | // ThMaker |
| 10 | function __th($n) { |
| 11 | |
| 12 | $ths = [__("st", 'backup-backup'), __("nd", 'backup-backup'), __("rd", 'backup-backup'), __("th", 'backup-backup')]; |
| 13 | $n = intval($n); |
| 14 | $nah = [11, 12, 13]; |
| 15 | |
| 16 | if (in_array($n, $nah)) return $ths[3]; |
| 17 | else { |
| 18 | |
| 19 | if (substr(''.$n, -1) == '1') return $ths[0]; |
| 20 | elseif (substr(''.$n, -1) == '2') return $ths[1]; |
| 21 | elseif (substr(''.$n, -1) == '3') return $ths[2]; |
| 22 | else return $ths[3]; |
| 23 | |
| 24 | } |
| 25 | |
| 26 | } |
| 27 | |
| 28 | $remotePing = __('This option makes the backup process rely on our External Keep-Alive Server instead of internal loopback requests. It is ideal for sites that block loopback requests or experience timeout issues.', 'backup-backup'); |
| 29 | $upgradeToPremiumTooltip = __('%sUpgrade to %sPremium%s today%s%s%sWe made it really affordable!%s', 'backup-backup'); |
| 30 | $upgradeToPremiumTooltip = sprintf($upgradeToPremiumTooltip, '<a href="' . BMI_AUTHOR_URI . '" target="_blank">', '<span class="bmi-premium-bg-stars">', '</span>', '</a>', '<br>', '<b>', '</b>', '<br>'); |
| 31 | |
| 32 | |
| 33 | ?> |
| 34 | |
| 35 | <div class="backup-creator cf section-bmi" id="bmi-section--cron"> |
| 36 | <div class="left"> |
| 37 | <div class="create-now pointer bmi-backup-btn one shadow" id="i-backup-creator"> |
| 38 | <div class="insider"></div> |
| 39 | <div class="insider-2"></div> |
| 40 | <div class="vcenter"> |
| 41 | <img src="<?php echo esc_url($this->get_asset('images', 'backup-min.svg')); ?>" alt="server-img" class="img-now"> |
| 42 | <div class="text"> |
| 43 | <span class="medium pointer"> |
| 44 | <?php esc_html_e('Create backup', 'backup-backup') ?> <span class="bold"><?php esc_html_e('now!', 'backup-backup') ?></span> |
| 45 | </span> |
| 46 | </div> |
| 47 | </div> |
| 48 | </div> |
| 49 | </div> |
| 50 | <div class="left cron-backups-wrap" id="i-backup-cron"> |
| 51 | <div class="cron-backups shadow relative<?php echo ((bmi_get_config('CRON:ENABLED') === false) ? ' disabled' : '') ?>"> |
| 52 | <div class="turned-off pointer transition"<?php echo ((bmi_get_config('CRON:ENABLED') === true) ? ' style="display: none"' : '') ?>> |
| 53 | <div class="vcenter"> |
| 54 | <div class="fullwidth"> |
| 55 | <div class="cf inline lh28"> |
| 56 | <div class="left"> |
| 57 | <img src="<?php echo esc_url($this->get_asset('images', 'timemachine.svg')); ?>" alt="cron-icon" height="30px;"> |
| 58 | </div> |
| 59 | <div class="left"> |
| 60 | <span class="f20 regular"> |
| 61 | <?php esc_html_e('... or have', 'backup-backup') ?> |
| 62 | <span class="semibold"><?php esc_html_e('backups created automatically', 'backup-backup') ?></span> |
| 63 | </span> |
| 64 | </div> |
| 65 | </div> |
| 66 | </div> |
| 67 | </div> |
| 68 | </div> |
| 69 | <div class="turned-on f18"<?php echo ((bmi_get_config('CRON:ENABLED') === false) ? ' style="display: none"' : '') ?>> |
| 70 | |
| 71 | <div class="cron-a cf"> |
| 72 | <div class="left semibold relative"> |
| 73 | <?php esc_html_e("Automatic backups creation", 'backup-backup'); ?> |
| 74 | <span class="bmi-info-icon tooltip cron-time-server" tooltip=""></span> |
| 75 | </div> |
| 76 | <div class="right"> |
| 77 | |
| 78 | <label for="cron-btn-toggle" class="bmi-switch"> |
| 79 | <input type="checkbox" id="cron-btn-toggle"<?php echo ((bmi_get_config('CRON:ENABLED') === false) ? ' checked' : '') ?>> |
| 80 | <div class="bmi-switch-slider round"> |
| 81 | <span class="on"><?php esc_html_e("On", 'backup-backup'); ?></span> |
| 82 | <span class="off"><?php esc_html_e("Off", 'backup-backup'); ?></span> |
| 83 | </div> |
| 84 | </label> |
| 85 | |
| 86 | </div> |
| 87 | </div> |
| 88 | |
| 89 | <div class="cron-bc"> |
| 90 | <div class="cron-b bg-second cf"> |
| 91 | <table class="ooo-to-pad"> |
| 92 | <tbody> |
| 93 | <tr> |
| 94 | <td class="orr" style="min-width: 76px;"><?php esc_html_e("Create a backup every", 'backup-backup'); ?></td> |
| 95 | <td> |
| 96 | <select id="cron-period" data-parent="#bmi-section--cron" data-classes="orr" data-def="<?php echo esc_attr(sanitize_text_field(bmi_get_config('CRON:TYPE'))); ?>"> |
| 97 | <option value="month"><?php esc_html_e("Month", 'backup-backup'); ?></option> |
| 98 | <option value="week"><?php esc_html_e("Week", 'backup-backup'); ?></option> |
| 99 | <option value="day"><?php esc_html_e("Day", 'backup-backup'); ?></option> |
| 100 | </select> |
| 101 | </td> |
| 102 | <td id="cron-on-word"><?php esc_html_e("on", 'backup-backup'); ?></td> |
| 103 | <td class="cron-the"><?php esc_html_e("the", 'backup-backup'); ?></td> |
| 104 | <td> |
| 105 | <select id="cron-day" data-parent="#bmi-section--cron" data-classes="left orr oll" data-def="<?php echo esc_attr(sanitize_text_field(bmi_get_config('CRON:DAY'))); ?>"> |
| 106 | <?php for ($i = 0; $i < 28; ++$i): ?> |
| 107 | <?php $d = ($i+1); ?> |
| 108 | <option value="<?php echo esc_attr($d); ?>"><?php echo esc_html($d . __th($d)); ?></option> |
| 109 | <?php endfor; ?> |
| 110 | </select> |
| 111 | </td> |
| 112 | <td> |
| 113 | <select id="cron-week" data-parent="#bmi-section--cron" data-classes="orr oll" data-hide="true" data-def="<?php echo esc_attr(sanitize_text_field(bmi_get_config('CRON:WEEK'))); ?>"> |
| 114 | <option value="1"><?php esc_html_e("Monday", 'backup-backup'); ?></option> |
| 115 | <option value="2"><?php esc_html_e("Tuesday", 'backup-backup'); ?></option> |
| 116 | <option value="3"><?php esc_html_e("Wednesday", 'backup-backup'); ?></option> |
| 117 | <option value="4"><?php esc_html_e("Thursday", 'backup-backup'); ?></option> |
| 118 | <option value="5"><?php esc_html_e("Friday", 'backup-backup'); ?></option> |
| 119 | <option value="6"><?php esc_html_e("Saturday", 'backup-backup'); ?></option> |
| 120 | <option value="7"><?php esc_html_e("Sunday", 'backup-backup'); ?></option> |
| 121 | </select> |
| 122 | </td> |
| 123 | <td class="orr"><?php esc_html_e("at", 'backup-backup'); ?></td> |
| 124 | <td> |
| 125 | <select id="cron-hour" data-parent="#bmi-section--cron" data-def="<?php echo esc_attr(sanitize_text_field(bmi_get_config('CRON:HOUR'))); ?>"> |
| 126 | <?php for ($i = 0; $i < 24; ++$i): ?> |
| 127 | <?php $d = substr('0' . ($i), -2); ?> |
| 128 | <option value="<?php echo esc_attr($d); ?>"><?php echo esc_html($d); ?></option> |
| 129 | <?php endfor; ?> |
| 130 | </select> |
| 131 | </td> |
| 132 | <td class="orr oll"><?php esc_html_e("hours and", 'backup-backup'); ?></td> |
| 133 | <td> |
| 134 | <select id="cron-minute" data-parent="#bmi-section--cron" data-def="<?php echo esc_attr(sanitize_text_field(bmi_get_config('CRON:MINUTE'))); ?>"> |
| 135 | <?php for ($i = 0; $i < 60; $i += 5): ?> |
| 136 | <?php $d = substr('0' . ($i), -2); ?> |
| 137 | <option value="<?php echo esc_attr($d); ?>"><?php echo esc_html($d); ?></option> |
| 138 | <?php endfor; ?> |
| 139 | </select> |
| 140 | </td> |
| 141 | <td class="orr"><?php esc_html_e("minutes", 'backup-backup'); ?></td> |
| 142 | </tr> |
| 143 | </tbody> |
| 144 | </table> |
| 145 | </div> |
| 146 | |
| 147 | <?php if(has_action('bmip_backup_methods')): ?> |
| 148 | <?php do_action('bmip_backup_methods'); ?> |
| 149 | <?php else: ?> |
| 150 | |
| 151 | <div class="cron-ping-wrap" style="margin-left: 35px; margin-top: 15px;"> |
| 152 | <label for="remote-ping" class="not-allowed"> |
| 153 | <input type="checkbox" class="not-allowed" id="remote-ping" name="backup-method" disabled> |
| 154 | <span> |
| 155 | <?php esc_html_e('Use remote server assistance for scheduled backups', 'backup-backup'); ?> |
| 156 | <span class="bmi-info-icon tooltip not-allowed" tooltip="<?php echo esc_attr($remotePing); ?>"></span> |
| 157 | |
| 158 | </span> |
| 159 | <span class="inline premium-wrapper is-pro" tooltip="<?php echo esc_attr($upgradeToPremiumTooltip); ?>" > |
| 160 | <span class="premium premium-img premium-ntt"></span> |
| 161 | </span> |
| 162 | </label> |
| 163 | </div> |
| 164 | |
| 165 | <?php endif; ?> |
| 166 | |
| 167 | <div class="cron-c cf"> |
| 168 | <table class="left ooo-to-pad" style="max-width: calc(100% - 110px);"> |
| 169 | <tbody> |
| 170 | <tr> |
| 171 | <td class="orr oll"> |
| 172 | <?php esc_html_e("...and keep the last", 'backup-backup'); ?> |
| 173 | </td> |
| 174 | <td> |
| 175 | <select id="cron-keep-backups" data-parent="#bmi-section--cron" data-def="<?php echo esc_attr(sanitize_text_field(bmi_get_config('CRON:KEEP'))); ?>"> |
| 176 | <?php for ($i = 0; $i < 30; ++$i): ?> |
| 177 | <option value="<?php echo esc_attr($i+1); ?>"><?php echo esc_html($i+1); ?></option> |
| 178 | <?php endfor; ?> |
| 179 | </select> |
| 180 | </td> |
| 181 | <td class="orr oll"> |
| 182 | <?php esc_html_e("backups that have been created automatically.", 'backup-backup'); ?> |
| 183 | </td> |
| 184 | </tr> |
| 185 | </tbody> |
| 186 | </table> |
| 187 | <div class="lrn-mr-btn hoverable secondary right"> |
| 188 | <?php esc_html_e('Learn more', 'backup-backup'); ?> |
| 189 | </div> |
| 190 | </div> |
| 191 | </div> |
| 192 | |
| 193 | </div> |
| 194 | </div> |
| 195 | </div> |
| 196 | </div> |
| 197 | |
| 198 | <div class="mbl learn_more_about_cron" style="display: none;"> |
| 199 | <ol style="list-style: outside;"> |
| 200 | <li> |
| 201 | <?php esc_html_e("Above times are", 'backup-backup'); ?> |
| 202 | <b><?php esc_html_e("server times", 'backup-backup'); ?></b> |
| 203 | (<?php esc_html_e("time now:", 'backup-backup'); ?> <span id="server-time-auto" data-time="<?php echo esc_attr(time()); ?>"></span>) |
| 204 | </li> |
| 205 | <li> |
| 206 | <?php esc_html_e("We suggest", 'backup-backup'); ?> |
| 207 | <b><?php esc_html_e("keeping only 2 or 3 backups", 'backup-backup'); ?></b> |
| 208 | <?php esc_html_e(", otherwise you may run out of space.", 'backup-backup'); ?> |
| 209 | </li> |
| 210 | <li> |
| 211 | <b><?php echo wp_kses_post( __('Locked backups will <u>not</u> be deleted', 'backup-backup') ); ?></b> |
| 212 | <?php esc_html_e("automatically. Those are indicated by a lock sign", 'backup-backup'); ?> |
| 213 | <img src="<?php echo esc_url($this->get_asset('images', 'lock-min.svg')); ?>" alt="lock" class="inline" height="18px">. |
| 214 | <?php esc_html_e('Manually created backups (i.e., those created by clicking on "Create backup now!") are permanently locked, while automatically created backups are by default unlocked.', 'backup-backup'); ?> |
| 215 | <?php esc_html_e("You can change their lock status on the", 'backup-backup'); ?> |
| 216 | <span class="secondary hoverable go-to-marbs"><?php esc_html_e("Manage & Restore Backup(s)", 'backup-backup'); ?></span> |
| 217 | <?php esc_html_e("tab", 'backup-backup'); ?>. |
| 218 | </li> |
| 219 | <li> |
| 220 | <?php esc_html_e("For", 'backup-backup'); ?> |
| 221 | <b><?php esc_html_e("other triggers", 'backup-backup'); ?></b> |
| 222 | <?php esc_html_e("when your backups are created, please go", 'backup-backup'); ?> |
| 223 | <span class="secondary hoverable collapser-openner" data-el="#other-options"><?php esc_html_e("here", 'backup-backup'); ?></span>. |
| 224 | </li> |
| 225 | </ol> |
| 226 | <div class="right-align hoverable secondary closer-learn-more"> |
| 227 | <?php esc_html_e("Collapse", 'backup-backup'); ?> |
| 228 | </div> |
| 229 | </div> |
| 230 |