src/includes/classes/Core/Utils/Cdn.php
public function filter(string $url_uri_qsl): string
    {
        if (!$this->App->Config->©urls['©cdn_filter_enable']) {
            return $url_uri_qsl; // Nothing to do.
        }
        if (!$this->App->Config->©urls['©hosts']['©cdn']) {
            return $url_uri_qsl; // Nothing to do.
        }
        if (!($parts = $this->c::parseUrl($url_uri_qsl))) {
            return $url_uri_qsl; // Not possible.
        }
        if (empty($parts['path'])) {
            return $url_uri_qsl; // Not applicable.
        }
        if (!empty($parts['user']) || !empty($parts['pass'])) {
            return $url_uri_qsl; // Not applicable.
        }
        if (!($ext = $this->c::fileExt($parts['path']))) {
            return $url_uri_qsl; // No extension.
        }
        if (!in_array($ext, $this->static_exts, true)) {
            return $url_uri_qsl; // Not applicable.
        }
        if (!empty($parts['host'])) { // Has a host name?
            $host_root = $this->c::parseUrlHost($parts['host'])['root'];
            $app_root  = $this->App->Config->©urls['©hosts']['©roots']['©app'];
            if (!$host_root || $this->c::mbStrCaseCmp($host_root, $app_root) !== 0) {
                return $url_uri_qsl; // Not applicable.
            } // Also check for an empty/invalid root here.
        } // If there is a host part, it must have an app root!

        $uri = $parts; // w/ URI parts only.
        unset($uri['scheme'], $uri['host'], $uri['port']);
        $uri = $this->c::unparseUrl($uri); // The URI only.

        return $this->url($uri, $parts['scheme'] ?? '');
    }
public function filter(string $url_uri_qsl): string
    {
        if (!$this->App->Config->©urls['©cdn_filter_enable']) {
            return $url_uri_qsl; // Nothing to do.
        }
        if (!$this->App->Config->©urls['©hosts']['©cdn']) {
            return $url_uri_qsl; // Nothing to do.
        }
        if (!($parts = $this->c::parseUrl($url_uri_qsl))) {
            return $url_uri_qsl; // Not possible.
        }
        if (empty($parts['path'])) {
            return $url_uri_qsl; // Not applicable.
        }
        if (!empty($parts['user']) || !empty($parts['pass'])) {
            return $url_uri_qsl; // Not applicable.
        }
        if (!($ext = $this->c::fileExt($parts['path']))) {
            return $url_uri_qsl; // No extension.
        }
        if (!in_array($ext, $this->static_exts, true)) {
            return $url_uri_qsl; // Not applicable.
        }
        if (!empty($parts['host'])) { // Has a host name?
            $host_root = $this->c::parseUrlHost($parts['host'])['root'];
            $app_root  = $this->App->Config->©urls['©hosts']['©roots']['©app'];
            if (!$host_root || $this->c::mbStrCaseCmp($host_root, $app_root) !== 0) {
                return $url_uri_qsl; // Not applicable.
            } // Also check for an empty/invalid root here.
        } // If there is a host part, it must have an app root!

        $uri = $parts; // w/ URI parts only.
        unset($uri['scheme'], $uri['host'], $uri['port']);
        $uri = $this->c::unparseUrl($uri); // The URI only.

        return $this->url($uri, $parts['scheme'] ?? '');
    }
CDN URL filter.

@since 150424 Initial release.

@param string $url_uri_qsl Input URL, URI, or query string w/ a leading `?`.

@return string Output URL, URI, or query string w/ a leading `?`.