Exemple #1
0
<?php 
}
?>

</p>

<p>&#10003; <span class="hmbkp_estimated-size"><?php 
printf(__('Your site is %s. Backups will be compressed and should be smaller than this.', 'hmbkp'), get_transient('hmbkp_estimated_filesize') ? '<code>' . hmbkp_calculate() . '</code>' : '<code class="calculate">' . __('Calculating Size...', 'hmbkp') . '</code>');
?>
</span></p>

<?php 
if (hmbkp_get_email_address()) {
    ?>
<p>&#10003; <?php 
    printf(__('A copy of each backup will be emailed to %s.', 'hmbkp'), '<code>' . hmbkp_get_email_address() . '</code>');
    ?>
</p>
<?php 
}
?>

<?php 
if (($valid_excludes = hmbkp_valid_custom_excludes()) && !hmbkp_get_database_only()) {
    ?>
<p>&#10003; <?php 
    printf(__('The following paths will be excluded from your backups %s.', 'hmbkp'), '<code>' . implode('</code>, <code>', $valid_excludes) . '</code>');
    ?>
</p>
<?php 
}
 function hmbkp_email_invalid_warning()
 {
     echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __('BackUpWordPress has detected a problem.', 'hmbkp') . '</strong> ' . sprintf(__('%s is not a valid email address.', 'hmbkp'), '<code>' . hmbkp_get_email_address() . '</code>') . '</p></div>';
 }
Exemple #3
0
/**
 * Email backup.
 *
 *	@param $file
 * @return bool
 */
function hmbkp_email_backup()
{
    $file = HM_Backup::get_instance()->archive_filepath();
    if (!hmbkp_get_email_address() || !file_exists($file)) {
        return;
    }
    update_option('hmbkp_email_error', 'hmbkp_email_failed');
    // Raise the memory and time limit
    @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
    @set_time_limit(0);
    // @todo admin_url?
    $download = get_bloginfo('wpurl') . '/wp-admin/tools.php?page=' . HMBKP_PLUGIN_SLUG . '&hmbkp_download=' . base64_encode($file);
    $domain = parse_url(get_bloginfo('url'), PHP_URL_HOST) . parse_url(get_bloginfo('url'), PHP_URL_PATH);
    $subject = sprintf(__('Backup of %s', 'hmbkp'), $domain);
    $message = sprintf(__("BackUpWordPress has completed a backup of your site %s.\n\nThe backup file should be attached to this email.\n\nYou can also download the backup file by clicking the link below:\n\n%s\n\nKind Regards\n\n The Happy BackUpWordPress Backup Emailing Robot", 'hmbkp'), get_bloginfo('url'), $download);
    $headers = 'From: BackUpWordPress <' . get_bloginfo('admin_email') . '>' . "\r\n";
    // Try to send the email
    $sent = wp_mail(hmbkp_get_email_address(), $subject, $message, $headers, $file);
    // If it failed- Try to send a download link - The file was probably too large.
    if (!$sent) {
        $subject = sprintf(__('Backup of %s', 'hmbkp'), $domain);
        $message = sprintf(__("BackUpWordPress has completed a backup of your site %s.\n\nUnfortunately the backup file was too large to attach to this email.\n\nYou can download the backup file by clicking the link below:\n\n%s\n\nKind Regards\n\n The Happy BackUpWordPress Backup Emailing Robot", 'hmbkp'), get_bloginfo('url'), $download);
        $sent = wp_mail(hmbkp_get_email_address(), $subject, $message, $headers);
    }
    // Set option for email not sent error
    if ($sent) {
        delete_option('hmbkp_email_error');
    }
    return true;
}
Exemple #4
0
_e('Number of backups', 'hmbkp');
?>
</label></th>
					<td><label for="hmbkp_backup_number"><?php 
printf(__('The last %s backups will be stored on the server.', 'hmbkp'), '<input type="text" class="small-text ' . (defined('HMBKP_MAX_BACKUPS') ? 'disabled' : '') . '" value="' . hmbkp_max_backups() . '" id="hmbkp_backup_number" name="hmbkp_backup_number"' . disabled(defined('HMBKP_MAX_BACKUPS'), true, false) . '>');
?>
</label></td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><label for="hmbkp_email_address"><?php 
_e('Email backups', 'hmbkp');
?>
</label></th>
					<td><input name="hmbkp_email_address" type="text" id="hmbkp_email_address" value="<?php 
echo hmbkp_get_email_address();
?>
" class="regular-text <?php 
if (defined('HMBKP_EMAIL')) {
    echo 'disabled';
}
?>
" <?php 
disabled(defined('HMBKP_EMAIL'));
?>
> <span class="description"><?php 
_e('A copy of the backup file will be emailed to this address. Disabled if left blank.', 'hmbkp');
?>
</span></td>
				</tr>