예제 #1
0
 /**
  * Gets the settings for a similar destination from the existing schedules
  * so that we can copy them into the form to avoid having to type them again
  */
 protected function fetch_destination_settings()
 {
     $service = get_class($this);
     $schedules_obj = HMBKP_Schedules::get_instance();
     $schedules = $schedules_obj->get_schedules();
     foreach ($schedules as $schedule) {
         if ($schedule->get_id() != $this->schedule->get_id()) {
             $options = $schedule->get_service_options($service);
             if (!empty($options)) {
                 return $options;
             }
         }
     }
     return array();
 }
예제 #2
0
/**
 * Display the row of actions for a schedule
 *
 * @access public
 * @param HMBKP_Scheduled_Backup $schedule
 * @return void
 */
function hmbkp_schedule_actions(HMBKP_Scheduled_Backup $schedule)
{
    // Start output buffering
    ob_start();
    ?>

	<span class="hmbkp-status"><?php 
    echo $schedule->get_status() ? wp_kses_data($schedule->get_status()) : __('Starting Backup', 'hmbkp');
    ?>
 <a href="<?php 
    echo esc_url(add_query_arg(array('action' => 'hmbkp_cancel', 'hmbkp_schedule_id' => $schedule->get_id()), HMBKP_ADMIN_URL));
    ?>
"><?php 
    _e('cancel', 'hmbkp');
    ?>
</a></span>

	<div class="hmbkp-schedule-actions row-actions">

		<a class="colorbox" href="<?php 
    echo esc_url(add_query_arg(array('action' => 'hmbkp_edit_schedule_load', 'hmbkp_schedule_id' => $schedule->get_id()), admin_url('admin-ajax.php')));
    ?>
"><?php 
    _e('Settings', 'hmbkp');
    ?>
</a> |

	<?php 
    if ($schedule->get_type() !== 'database') {
        ?>
		<a class="colorbox" href="<?php 
        echo esc_url(add_query_arg(array('action' => 'hmbkp_edit_schedule_excludes_load', 'hmbkp_schedule_id' => $schedule->get_id()), admin_url('admin-ajax.php')));
        ?>
"><?php 
        _e('Excludes', 'hmbkp');
        ?>
</a>  |
	<?php 
    }
    ?>

		<?php 
    // capture output
    $output = ob_get_clean();
    echo apply_filters('hmbkp_schedule_actions_menu', $output, $schedule);
    ?>

		<a class="hmbkp-run" href="<?php 
    echo esc_url(add_query_arg(array('action' => 'hmbkp_run_schedule', 'hmbkp_schedule_id' => $schedule->get_id()), admin_url('admin-ajax.php')));
    ?>
"><?php 
    _e('Run now', 'hmbkp');
    ?>
</a>  |

		<a class="delete-action" href="<?php 
    echo wp_nonce_url(add_query_arg(array('action' => 'hmbkp_delete_schedule', 'hmbkp_schedule_id' => $schedule->get_id()), HMBKP_ADMIN_URL), 'hmbkp-delete_schedule');
    ?>
"><?php 
    _e('Delete', 'hmbkp');
    ?>
</a>

	</div>

<?php 
}
예제 #3
0
/**
 * Display the row of actions for a schedule
 *
 * @access public
 * @param HMBKP_Scheduled_Backup $schedule
 * @return void
 */
function hmbkp_schedule_status(HMBKP_Scheduled_Backup $schedule, $echo = true)
{
    ob_start();
    ?>

	<span class="hmbkp-status"<?php 
    if ($schedule->get_status()) {
        ?>
 title="<?php 
        printf(__('Started %s ago', 'hmbkp'), human_time_diff($schedule->get_schedule_running_start_time()));
        ?>
"<?php 
    }
    ?>
>
		<?php 
    echo $schedule->get_status() ? wp_kses_data($schedule->get_status()) : __('Starting Backup', 'hmbkp');
    ?>
		<a href="<?php 
    echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'hmbkp_request_cancel_backup', 'hmbkp_schedule_id' => $schedule->get_id()), hmbkp_get_settings_url()), 'hmbkp_request_cancel_backup', 'hmbkp_request_cancel_backup_nonce'));
    ?>
"><?php 
    _e('cancel', 'hmbkp');
    ?>
</a>
	</span>

	<?php 
    $output = ob_get_clean();
    if (!$echo) {
        return $output;
    }
    echo $output;
}
예제 #4
0
/**
 * Display the row of actions for a schedule
 *
 * @access public
 * @param HMBKP_Scheduled_Backup $schedule
 * @return void
 */
function hmbkp_schedule_status(HMBKP_Scheduled_Backup $schedule, $echo = true)
{
    ob_start();
    ?>

	<span class="hmbkp-status"<?php 
    if ($schedule->get_status()) {
        ?>
 title="<?php 
        printf(__('Started %s ago', 'backupwordpress'), human_time_diff($schedule->get_schedule_running_start_time()));
        ?>
"<?php 
    }
    ?>
>
		<?php 
    echo $schedule->get_status() ? wp_kses_data($schedule->get_status()) : __('Starting Backup', 'backupwordpress');
    ?>
		<a href="<?php 
    echo hmbkp_admin_action_url('request_cancel_backup', array('hmbkp_schedule_id' => $schedule->get_id()));
    ?>
"><?php 
    _e('cancel', 'backupwordpress');
    ?>
</a>
	</span>

	<?php 
    $output = ob_get_clean();
    if (!$echo) {
        return $output;
    }
    echo $output;
}