/**
     * Show avaliable backups list
     *
     * @since  1.0.0
     * @return string|null
     */
    public static function backups_list()
    {
        include_once monstroid_dashboard()->plugin_dir('admin/includes/class-monstroid-dashboard-backup-manager.php');
        $backup_manager = Monstroid_Dashboard_Backup_Manager::get_instance();
        $backups = $backup_manager->get_backups();
        if (empty($backups)) {
            return;
        }
        ob_start();
        ?>
		<div class="md-updates-list">
			<h4 class="md-updates-list_title"><?php 
        _e('Monstroid theme backups', 'monstroid-dashboard');
        ?>
</h4>
			<div class="md-updates-list_items">
				<div class="md-updates-list_item heading_item">
					<div class="md-updates-list_item_name">
						<?php 
        _e('File name', 'monstroid-dashboard');
        ?>
					</div>
					<div class="md-updates-list_item_date">
						<?php 
        _e('Created', 'monstroid-dashboard');
        ?>
					</div>
					<div class="md-updates-list_item_download">
						<?php 
        _e('Actions');
        ?>
					</div>
				</div>
				<?php 
        foreach ($backups as $file => $data) {
            // prepare download and delete URLs to use in template
            $download_url = add_query_arg(array('action' => 'monstroid_dashboard_get_backup', 'file' => $data['name']), admin_url('admin-ajax.php'));
            $download_url = wp_nonce_url($download_url, 'monstroid-dashboard', 'nonce');
            $delete_url = add_query_arg(array('action' => 'monstroid_dashboard_delete_backup', 'file' => $data['name']), admin_url('admin-ajax.php'));
            $delete_url = wp_nonce_url($delete_url, 'monstroid-dashboard', 'nonce');
            include monstroid_dashboard()->plugin_dir('admin/views/backup-list-item.php');
        }
        ?>
			</div>
		</div>
		<?php 
        return ob_get_clean();
    }
 /**
  * Try to make backup before updating
  *
  * @since  1.0.0
  * @return void|bool
  */
 public function try_make_backup()
 {
     if (!empty($_REQUEST['ignoreBackup'])) {
         return true;
     }
     include_once monstroid_dashboard()->plugin_dir('admin/includes/class-monstroid-dashboard-backup-manager.php');
     $backup_manager = Monstroid_Dashboard_Backup_Manager::get_instance();
     $backup_done = $backup_manager->make_backup();
     if (false === $backup_done) {
         $message = __('Can`t create current theme backup. <a href="#" class="force-run-theme-update">Update anyway</a>', 'monstroid-dashboard');
         wp_send_json_error(array('type' => 'backup_failed', 'message' => $message));
     }
     return $backup_done;
 }
 /**
  * Delete existing backup by name
  *
  * @since 1.0.0
  */
 public function delete_backup()
 {
     if (!isset($_REQUEST['nonce'])) {
         wp_die(__('Nonce key not provided', 'monstroid-dashboard'), __('Deleting Error', 'monstroid-dashboard'));
     }
     if (!wp_verify_nonce(esc_attr($_REQUEST['nonce']), 'monstroid-dashboard')) {
         wp_die(__('Incorrect nonce key', 'monstroid-dashboard'), __('Deleting Error', 'monstroid-dashboard'));
     }
     if (!current_user_can('manage_options')) {
         wp_die(__('Permission denied', 'monstroid-dashboard'), __('Deleting Error', 'monstroid-dashboard'));
     }
     $file = isset($_REQUEST['file']) ? esc_attr($_REQUEST['file']) : '';
     if (!$file) {
         wp_die(__('Backup file not provided', 'monstroid-dashboard'), __('Deleting Error', 'monstroid-dashboard'));
     }
     if (!isset($_SERVER['HTTP_REFERER'])) {
         wp_die(__('This action is not allowed directly', 'monstroid-dashboard'), __('Deleting Error', 'monstroid-dashboard'));
     }
     include_once monstroid_dashboard()->plugin_dir('admin/includes/class-monstroid-dashboard-backup-manager.php');
     $backup_manager = Monstroid_Dashboard_Backup_Manager::get_instance();
     $delete = $backup_manager->delete_backup($file);
     if (false == $delete) {
         wp_die($backup_manager->get_message(), __('Deleting Error', 'monstroid-dashboard'));
     }
     wp_safe_redirect(esc_url($_SERVER['HTTP_REFERER']));
     die;
 }
 /**
  * Returns the instance.
  *
  * @since  1.0.0
  * @return object
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }