public function handle_ajax_request($data) { global $itsec_backup; if (!isset($itsec_backup)) { require_once 'class-itsec-backup.php'; $itsec_backup = new ITSEC_Backup(); $itsec_backup->run(); } $result = $itsec_backup->do_backup(true); $message = ''; if (is_wp_error($result)) { $errors = ITSEC_Response::get_error_strings($result); foreach ($errors as $error) { $message .= '<div class="error inline"><p><strong>' . $error . '</strong></p></div>'; } } else { if (is_string($result)) { $message = '<div class="updated fade inline"><p><strong>' . $result . '</strong></p></div>'; } else { $message = '<div class="error inline"><p><strong>' . sprintf(__('The backup request returned an unexpected response. It returned a response of type <code>%1$s</code>.', 'better-wp-security'), gettype($result)) . '</strong></p></div>'; } } ITSEC_Response::set_response($message); }
<?php if (!class_exists('ITSEC_Backup')) { require dirname(__FILE__) . '/class-itsec-backup.php'; } if (!class_exists('ITSEC_Backup_Admin')) { require dirname(__FILE__) . '/class-itsec-backup-admin.php'; } $itsec_backup = ITSEC_Backup::start(); ITSEC_Backup_Admin::start($this, $itsec_backup);
/** * Performs actions for tooltip function. * * When the backup button on the new activation tooltip is clicked this will execute the one time backup. * * @since 4.0.0 * * return void */ public function tooltip_ajax() { if (!class_exists('ITSEC_Backup')) { require dirname(__FILE__) . '/class-itsec-backup.php'; } $module = new ITSEC_Backup(); $module->run($this->core); $result = $module->do_backup(true); if (true === $result) { die('true'); } else { die('false'); } }
function backup_db() { global $itsec_globals, $itsec_modules_path; if (!class_exists('ITSEC_Backup')) { require $itsec_modules_path . 'backup/class-itsec-backup.php'; } $module = new ITSEC_Backup(); $out = array(); if ($module->do_backup(false)) { $out['result'] = 'success'; } else { $out['result'] = 'fail'; } return $out; }
function backup_db() { global $itsec_globals; if (!class_exists('ITSEC_Backup')) { require trailingslashit($itsec_globals['plugin_dir']) . 'modules/free/backup/class-itsec-backup.php'; } $module = new ITSEC_Backup(); $out = array(); if ($module->do_backup(false)) { $out['result'] = 'success'; } else { $out['result'] = 'fail'; } return $out; }
<?php // Set up Backup Admin require_once 'class-itsec-backup-admin.php'; $itsec_backup_admin = new ITSEC_Backup_Admin(); $itsec_backup_admin->run(ITSEC_Core::get_instance()); // Set up Backup Frontend require_once 'class-itsec-backup.php'; $itsec_backup = new ITSEC_Backup(); $itsec_backup->run(ITSEC_Core::get_instance());
<?php require_once 'class-itsec-backup.php'; $itsec_backup = new ITSEC_Backup(); $itsec_backup->run();