/** * Compile the data that will be used by the front end to generate a QR Code for WordPress auto-config. * @since 1.4.0 */ public function wizard_easy_setup_qr_code() { if (isset($_POST['nonce'])) { if ($this->wp_facade->wp_verify_nonce($_POST['nonce'], static::WIZARD_NONCE_KEY) && $this->wp_facade->current_user_can('manage_options')) { $lk_nonce = $this->launchkey_client->auth()->nonce(); $this->update_option(static::EASY_SETUP_OPTION, array('nonce' => $lk_nonce, 'username' => $this->wp_facade->wp_get_current_user()->user_login)); $payload = json_encode(array('nonce' => $lk_nonce->getNonce(), 'payload' => array('callback_url' => $this->admin->get_callback_url(), 'rocket_name' => $this->wp_facade->get_bloginfo('name')))); $qr_data = base64_encode($payload); $response['nonce'] = $this->wp_facade->wp_create_nonce(static::WIZARD_NONCE_KEY); $response['qr_code'] = $qr_data; } else { $response['errors'] = $this->wp_facade->__("An error occurred submitting the page. Please refresh the page and submit again."); } $this->wp_facade->wp_send_json($response); } }