if ($database_options == '') { wp_redirect(admin_url('admin.php?page=' . $this->token . '&error-export=true')); return; } if (!$database_options) { return; } // Add our custom marker, to ensure only valid files are imported successfully. $database_options['OptionsFramework-backup-validator'] = date('Y-m-d h:i:s'); // Generate the export file. $output = json_encode((array) $database_options); header('Content-Description: File Transfer'); header('Cache-Control: public, must-revalidate'); header('Pragma: hack'); header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="' . $this->token . '-' . date('Ymd-His') . '.json"'); header('Content-Length: ' . strlen($output)); echo $output; exit; } } // End Class /** * Create $woo_backup Object. * * @since 1.0.0 * @uses OptionsFramework_Backup */ $of_backup = new OptionsFramework_Backup(); $of_backup->init();
function adap_init_options_export() { $of_backup = new OptionsFramework_Backup(); $of_backup->init(); }