<?php

$filesize = hmbkp_get_site_size_text($schedule);
// Backup Type
$type = strtolower(hmbkp_human_get_type($schedule->get_type()));
// Backup Time
$day = date_i18n('l', $schedule->get_next_occurrence(false));
$next_backup = 'title="' . esc_attr(sprintf(__('The next backup will be on %1$s at %2$s %3$s', 'backupwordpress'), date_i18n(get_option('date_format'), $schedule->get_next_occurrence(false)), date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false)), date_i18n('T', $schedule->get_next_occurrence(false)))) . '"';
// Backup Re-occurrence
switch ($schedule->get_reoccurrence()) {
    case 'hmbkp_hourly':
        $reoccurrence = date_i18n('i', $schedule->get_next_occurrence(false)) === '00' ? '<span ' . $next_backup . '>' . __('hourly on the hour', 'backupwordpress') . '</span>' : sprintf(__('hourly at %s minutes past the hour', 'backupwordpress'), '<span ' . $next_backup . '>' . intval(date_i18n('i', $schedule->get_next_occurrence(false)))) . '</span>';
        break;
    case 'hmbkp_daily':
        $reoccurrence = sprintf(__('daily at %s', 'backupwordpress'), '<span ' . $next_backup . '>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
        break;
    case 'hmbkp_twicedaily':
        $times[] = date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false));
        $times[] = date_i18n(get_option('time_format'), strtotime('+ 12 hours', $schedule->get_next_occurrence(false)));
        sort($times);
        $reoccurrence = sprintf(__('every 12 hours at %1$s &amp; %2$s', 'backupwordpress'), '<span ' . $next_backup . '>' . esc_html(reset($times)) . '</span>', '<span>' . esc_html(end($times))) . '</span>';
        break;
    case 'hmbkp_weekly':
        $reoccurrence = sprintf(__('weekly on %1$s at %2$s', 'backupwordpress'), '<span ' . $next_backup . '>' . esc_html($day) . '</span>', '<span>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
        break;
    case 'hmbkp_fortnightly':
        $reoccurrence = sprintf(__('biweekly on %1$s at %2$s', 'backupwordpress'), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
        break;
    case 'hmbkp_monthly':
        $reoccurrence = sprintf(__('on the %1$s of each month at %2$s', 'backupwordpress'), '<span ' . $next_backup . '>' . esc_html(date_i18n('jS', $schedule->get_next_occurrence(false))) . '</span>', '<span>' . esc_html(date_i18n(get_option('time_format'), $schedule->get_next_occurrence(false))) . '</span>');
        break;
Esempio n. 2
0
/**
 * Get the human readable backup type in.
 *
 * @access public
 * @param string                 $type
 * @param HMBKP_Scheduled_Backup $schedule (default: null)
 * @return string
 */
function hmbkp_human_get_type($type, HMBKP_Scheduled_Backup $schedule = null)
{
    if (strpos($type, 'complete') !== false) {
        return __('Database and Files', 'hmbkp');
    }
    if (strpos($type, 'file') !== false) {
        return __('Files', 'hmbkp');
    }
    if (strpos($type, 'database') !== false) {
        return __('Database', 'hmbkp');
    }
    if (!is_null($schedule)) {
        return hmbkp_human_get_type($schedule->get_type());
    }
    return __('Legacy', 'hmbkp');
}
    function hmbkp_get_backup_row($file, HM\BackUpWordPress\Scheduled_Backup $schedule)
    {
        $encoded_file = urlencode(base64_encode($file));
        $offset = get_option('gmt_offset') * 3600;
        ?>

	<tr class="hmbkp_manage_backups_row">

		<th scope="row">
			<?php 
        echo esc_html(date_i18n(get_option('date_format') . ' - ' . get_option('time_format'), @filemtime($file) + $offset));
        ?>
		</th>

		<td class="code">
			<?php 
        echo esc_html(size_format(@filesize($file)));
        ?>
		</td>

		<td><?php 
        echo esc_html(hmbkp_human_get_type($file, $schedule));
        ?>
</td>

		<td>

			<?php 
        if (hmbkp_is_path_accessible(hmbkp_path())) {
            ?>
				<a href="#" onclick="event.preventDefault(); mainwp_backupwp_download_backup('<?php 
            echo $encoded_file;
            ?>
', <?php 
            echo $schedule->get_id();
            ?>
, this);" class="download-action"><?php 
            _e('Download', 'backupwordpress');
            ?>
</a> |
			<?php 
        }
        ?>

			<a href="#" onclick="event.preventDefault(); mainwp_backupwp_delete_backup('<?php 
        echo $encoded_file;
        ?>
', <?php 
        echo $schedule->get_id();
        ?>
, this);"  class="delete-action"><?php 
        _e('Delete', 'backupwordpress');
        ?>
</a>

		</td>

	</tr>

<?php 
    }