Uname: Linux yisu-647059427c03a 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64
Software: nginx/1.22.1
PHP version: 7.3.31 [ PHP INFO ] PHP os: Linux
Server Ip: 103.146.158.90
Your Ip: 216.73.216.141
User: www (1000) | Group: www (1000)
Safe Mode: OFF
Disable Function:
passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv

name : UriResolver.php
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DomCrawler;

/**
 * The UriResolver class takes an URI (relative, absolute, fragment, etc.)
 * and turns it into an absolute URI against another given base URI.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 * @author Grégoire Pineau <lyrixx@lyrixx.info>
 */
class UriResolver
{
    /**
     * Resolves a URI according to a base URI.
     *
     * For example if $uri=/foo/bar and $baseUri=https://symfony.com it will
     * return https://symfony.com/foo/bar
     *
     * If the $uri is not absolute you must pass an absolute $baseUri
     */
    public static function resolve(string $uri, ?string $baseUri): string
    {
        $uri = trim($uri);

        // absolute URL?
        if (null !== parse_url($uri, \PHP_URL_SCHEME)) {
            return $uri;
        }

        if (null === $baseUri) {
            throw new \InvalidArgumentException('The URI is relative, so you must define its base URI passing an absolute URL.');
        }

        // empty URI
        if (!$uri) {
            return $baseUri;
        }

        // an anchor
        if ('#' === $uri[0]) {
            return self::cleanupAnchor($baseUri).$uri;
        }

        $baseUriCleaned = self::cleanupUri($baseUri);

        if ('?' === $uri[0]) {
            return $baseUriCleaned.$uri;
        }

        // absolute URL with relative schema
        if (0 === strpos($uri, '//')) {
            return preg_replace('#^([^/]*)//.*$#', '$1', $baseUriCleaned).$uri;
        }

        $baseUriCleaned = preg_replace('#^(.*?//[^/]*)(?:\/.*)?$#', '$1', $baseUriCleaned);

        // absolute path
        if ('/' === $uri[0]) {
            return $baseUriCleaned.$uri;
        }

        // relative path
        $path = parse_url(substr($baseUri, \strlen($baseUriCleaned)), \PHP_URL_PATH);
        $path = self::canonicalizePath(substr($path, 0, strrpos($path, '/')).'/'.$uri);

        return $baseUriCleaned.('' === $path || '/' !== $path[0] ? '/' : '').$path;
    }

    /**
     * Returns the canonicalized URI path (see RFC 3986, section 5.2.4).
     */
    private static function canonicalizePath(string $path): string
    {
        if ('' === $path || '/' === $path) {
            return $path;
        }

        if ('.' === substr($path, -1)) {
            $path .= '/';
        }

        $output = [];

        foreach (explode('/', $path) as $segment) {
            if ('..' === $segment) {
                array_pop($output);
            } elseif ('.' !== $segment) {
                $output[] = $segment;
            }
        }

        return implode('/', $output);
    }

    /**
     * Removes the query string and the anchor from the given uri.
     */
    private static function cleanupUri(string $uri): string
    {
        return self::cleanupQuery(self::cleanupAnchor($uri));
    }

    /**
     * Removes the query string from the uri.
     */
    private static function cleanupQuery(string $uri): string
    {
        if (false !== $pos = strpos($uri, '?')) {
            return substr($uri, 0, $pos);
        }

        return $uri;
    }

    /**
     * Removes the anchor from the uri.
     */
    private static function cleanupAnchor(string $uri): string
    {
        if (false !== $pos = strpos($uri, '#')) {
            return substr($uri, 0, $pos);
        }

        return $uri;
    }
}
© 2026 GrazzMean
https://ai.shandianfk.com/wp-sitemap-posts-post-1.xmlhttps://ai.shandianfk.com/wp-sitemap-posts-page-1.xmlhttps://ai.shandianfk.com/wp-sitemap-taxonomies-category-1.xmlhttps://ai.shandianfk.com/wp-sitemap-taxonomies-post_tag-1.xmlhttps://ai.shandianfk.com/wp-sitemap-users-1.xml