. * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ class Ai1wm_Backups_Controller { public static function index() { $model = new Ai1wm_Backups; Ai1wm_Template::render( 'backups/index', array( 'backups' => $model->get_files(), 'username' => get_option( AI1WM_AUTH_USER ), 'password' => get_option( AI1WM_AUTH_PASSWORD ), ) ); } public static function delete( $params = array() ) { $response = array( 'errors' => array() ); // Set params if ( empty( $params ) ) { $params = stripslashes_deep( $_POST ); } // Set archive $archive = null; if ( isset( $params['archive'] ) ) { $archive = trim( $params['archive'] ); } $model = new Ai1wm_Backups; try { // Delete file $model->delete_file( $archive ); } catch ( Exception $e ) { $response['errors'][] = $e->getMessage(); } echo json_encode( $response ); exit; } }