Example #1
0
/**
 * Plugin setup
 *
 * @return null
 */
function hmbkp_actions()
{
    $plugin_data = get_plugin_data(__FILE__);
    define('HMBKP_VERSION', $plugin_data['Version']);
    load_plugin_textdomain('hmbkp', false, HMBKP_PLUGIN_SLUG . '/languages/');
    // Fire the update action
    if (HMBKP_VERSION > get_option('hmbkp_plugin_version')) {
        hmbkp_update();
    }
    // Load admin css and js
    if (isset($_GET['page']) && $_GET['page'] == HMBKP_PLUGIN_SLUG) {
        wp_enqueue_script('hmbkp', HMBKP_PLUGIN_URL . '/assets/hmbkp.js');
        wp_enqueue_style('hmbkp', HMBKP_PLUGIN_URL . '/assets/hmbkp.css');
    }
    // Handle any advanced option changes
    hmbkp_constant_changes();
}
 /**
  * If the HMBKP_PATH constant is defined and the new directory is writable then everything should be moved there
  *
  * @access public
  * @return void
  */
 public function testUnWritableDefinedBackupPath()
 {
     $this->assertEquals(hmbkp_path(), HMBKP_PATH);
     $this->backup->backup();
     $this->assertFileExists($this->backup->get_archive_filepath());
     chmod($this->custom_path, 0555);
     if (is_writable($this->custom_path)) {
         $this->markTestSkipped('The custom path was still writable');
     }
     hmbkp_constant_changes();
     $this->assertEquals(hmbkp_path(), hmbkp_path_default());
     $this->assertFileExists(str_replace($this->backup->get_path(), hmbkp_path_default(), $this->backup->get_archive_filepath()));
     // They should both exist because we didn't have permission to remove the old file
     $this->assertFileExists($this->backup->get_archive_filepath());
 }
Example #3
0
<?php

// If the form has been submitted, things may have changed.
if (!empty($_POST['hmbkp_settings_submit']) && (!wp_next_scheduled('hmbkp_schedule_backup_hook') || hmbkp_get_disable_automatic_backup())) {
    hmbkp_constant_changes();
}
?>

<p>&#10003;

<?php 
if (hmbkp_get_disable_automatic_backup() && !wp_next_scheduled('hmbkp_schedule_backup_hook')) {
    ?>

    <?php 
    printf(__('Automatic backups are %s.', 'hmbkp'), '<strong>' . __('disabled', 'hmbkp') . '</strong>');
    ?>

<?php 
} else {
    if (!hmbkp_get_database_only() && !hmbkp_get_files_only()) {
        $what_to_backup = '<code>' . __('database', 'hmbkp') . '</code> ' . __('&amp;', 'hmbkp') . ' <code>' . __('files', 'hmbkp') . '</code>';
    } elseif (hmbkp_get_database_only()) {
        $what_to_backup = '<code>' . __('database', 'hmbkp') . '</code>';
    } else {
        $what_to_backup = '<code>' . __('files', 'hmbkp') . '</code>';
    }
    ?>

    	<?php 
    $offset = current_time('timestamp') - time();