/** * Redirects to a URL corrected for the language information in it, in case request URI and $_REQUEST['lang'], * requested domain or $_SERVER['REQUEST_URI'] do not match and gives precedence to the explicit language parameter if * there. * * @return string The language code of the currently requested URL in case no redirection was necessary. */ public function maybe_redirect() { if (($target = $this->redirect_helper->get_redirect_target()) !== false) { $this->sitepress->get_wp_api()->wp_safe_redirect($target); } // allow forcing the current language when it can't be decoded from the URL return $this->lang_resolution->current_lang_filter($this->request_handler->get_requested_lang()); }
protected function redirect_hidden_home() { $target = false; if ($this->lang_resolution->is_language_hidden($this->request_handler->get_request_uri_lang()) && !$this->request_handler->show_hidden()) { $target = $this->url_converter->get_abs_home(); } return $target; }