/** * Deploy From Staging * Sends the api request to deploy from stagin */ public function deploy_staging() { if (!is_user_logged_in()) { wp_die("Must be an autheticated user"); } if (!current_user_can('administrator')) { wp_die("Must be an administrator"); } if (!defined("PWP_NAME") or !defined('WPE_APIKEY')) { echo "This process could not be started."; } require_once WPE_PLUGIN_DIR . '/class-wpeapi.php'; $db_mode = @$_REQUEST['db_mode'] ?: 'default'; $email = @$_REQUEST['email'] ?: get_option('admin_email'); $tables = @$_REQUEST['tables'] ?: false; $api = new WPE_API(); $api->set_arg('method', 'deploy-from-staging'); $api->set_arg('db_mode', esc_attr($db_mode)); $api->set_arg('email', esc_attr($email)); if ($tables) { $api->set_arg('tables', implode('&', $tables)); } $api->set_arg('headers', "Host:api.wpengine.com"); $api->post(); if (!$api->is_error()) { echo "Your request has been submitted. You will receive an email once it has been processed"; } else { echo $api->is_error(); } die; }