コード例 #1
0
/**
 * Returns a formatted string containing the calculated total site size or a message
 * to indicate it is being calculated.
 *
 * @param HM\BackUpWordPress\Scheduled_Backup $schedule
 *
 * @return string
 */
function get_site_size_text(Scheduled_Backup $schedule)
{
    if (isset($_GET['hmbkp_add_schedule'])) {
        return '';
    }
    $site_size = new Site_Size($schedule->get_type(), $schedule->get_excludes());
    if ('database' === $schedule->get_type() || $site_size->is_site_size_cached()) {
        return sprintf('(<code title="' . __('Backups will be compressed and should be smaller than this.', 'backupwordpress') . '">%s</code>)', esc_html($site_size->get_formatted_site_size()));
    }
    return '';
}
コード例 #2
0
ファイル: actions.php プロジェクト: crazyyy/bessarabia
/**
 * Delete an exclude rule
 *
 * @access public
 * @return void
 */
function remove_exclude_rule()
{
    check_admin_referer('hmbkp_remove_exclude_rule', 'hmbkp-remove_exclude_rule_nonce');
    if (!isset($_GET['hmbkp_remove_exclude'])) {
        die;
    }
    $schedule = new Scheduled_Backup(sanitize_text_field($_GET['hmbkp_schedule_id']));
    $excludes = $schedule->get_excludes();
    $exclude_rule_to_remove = stripslashes(sanitize_text_field($_GET['hmbkp_remove_exclude']));
    $schedule->set_excludes(array_diff($excludes->get_user_excludes(), (array) $exclude_rule_to_remove));
    $schedule->save();
    delete_transient('hmbkp_root_size');
    wp_safe_redirect(wp_get_referer(), '303');
    die;
}
/**
 * Returns a formatted string containing the calculated total site size or a message
 * to indicate it is being calculated.
 *
 * @param HM\BackUpWordPress\Scheduled_Backup $schedule
 *
 * @return string
 */
function get_site_size_text(Scheduled_Backup $schedule)
{
    if (isset($_GET['hmbkp_add_schedule'])) {
        return '';
    }
    $site_size = new Site_Size($schedule->get_type(), $schedule->get_excludes());
    if ('database' === $schedule->get_type() || $site_size->is_site_size_cached()) {
        return sprintf('(<code title="' . __('Backups will be compressed and should be smaller than this.', 'backupwordpress') . '">%s</code>)', esc_attr($site_size->get_formatted_site_size()));
    } else {
        return sprintf('(<code class="calculating" title="' . __('this shouldn\'t take long&hellip;', 'backupwordpress') . '">' . __('calculating the size of your site&hellip;', 'backupwordpress') . '</code>)');
    }
}