/** * Redirects to SSL checkout page. */ public function redirectToSsl() { $page = $this->options->getPageId(Pages::CHECKOUT); $url = str_replace('http:', 'https:', $this->wp->getPermalink($page)); $this->wp->wpSafeRedirect($url, 301); exit; }
/** * Validates settings for WordPress to save. * * @param array $input Input data to validate. * * @return array Sanitized output for saving. */ public function validate($input) { try { $currentTab = $this->getCurrentTab(); /** @var TabInterface $tab */ $tab = $this->tabs[$currentTab]; $this->options->update($currentTab, $tab->validate($input)); } catch (Admin\Settings\ValidationException $e) { $this->messages->addError($e->getMessage(), true); $this->wp->wpSafeRedirect(admin_url(sprintf('admin.php?page=%s&tab=%s', self::NAME, $tab->getSlug()))); exit; } return $this->options->getAll(); }