21 $this->url = $this->getCurrentUrl();
27 public function setUrl(
string $url): void
43 private function getCurrentUrl(): string
45 $request = Main\Application::getInstance()->getContext()->getRequest();
49 if (class_exists(
'\LandingPubComponent'))
51 $landingInstance = \LandingPubComponent::getMainInstance();
54 $context = Main\Context::getCurrent();
56 $realFilePath = $context->getServer()->get(
'REAL_FILE_PATH');
59 $realFilePath = $_SERVER[
'REAL_FILE_PATH'] ??
null;
63 $realFilePath = $context->getServer()->get(
'SCRIPT_NAME');
66 $realFilePath = str_replace(
'/index.php',
'/', $realFilePath);
67 $requestUri = $request->getRequestUri();
69 $landingUrl = \Bitrix\Landing\Site::getPublicUrl($landingInstance[
'SITE_ID']);
70 if (mb_strpos($landingUrl, $realFilePath) ===
false)
72 $requestUri = str_replace($realFilePath.$landingInstance[
'SITE_ID'],
'', $requestUri);
75 $uri =
new Main\Web\Uri($landingUrl);
76 $host = $uri->getHost();
82 $host = $request->getHttpHost();
87 $requestUri = $request->getRequestUri();
90 return ($request->isHttps() ?
"https://" :
"http://").$host.$requestUri;