WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

YoastSEO_Vendor\GuzzleHttp\Psr7

ServerRequest::getUriFromGlobals() public Yoast 1.0

Get a Uri populated with values from $_SERVER.

{} Это метод класса: ServerRequest{}

Хуков нет.

Возвращает

UriInterface.

Использование

$result = ServerRequest::getUriFromGlobals();

Код ServerRequest::getUriFromGlobals() Yoast 15.3

<?php
public static function getUriFromGlobals()
{
    $uri = new \YoastSEO_Vendor\GuzzleHttp\Psr7\Uri('');
    $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
    $hasPort = \false;
    if (isset($_SERVER['HTTP_HOST'])) {
        list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
        if ($host !== null) {
            $uri = $uri->withHost($host);
        }
        if ($port !== null) {
            $hasPort = \true;
            $uri = $uri->withPort($port);
        }
    } elseif (isset($_SERVER['SERVER_NAME'])) {
        $uri = $uri->withHost($_SERVER['SERVER_NAME']);
    } elseif (isset($_SERVER['SERVER_ADDR'])) {
        $uri = $uri->withHost($_SERVER['SERVER_ADDR']);
    }
    if (!$hasPort && isset($_SERVER['SERVER_PORT'])) {
        $uri = $uri->withPort($_SERVER['SERVER_PORT']);
    }
    $hasQuery = \false;
    if (isset($_SERVER['REQUEST_URI'])) {
        $requestUriParts = \explode('?', $_SERVER['REQUEST_URI'], 2);
        $uri = $uri->withPath($requestUriParts[0]);
        if (isset($requestUriParts[1])) {
            $hasQuery = \true;
            $uri = $uri->withQuery($requestUriParts[1]);
        }
    }
    if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) {
        $uri = $uri->withQuery($_SERVER['QUERY_STRING']);
    }
    return $uri;
}