Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Register::normalize_url()privateWC 1.0

Normalizes the provided URL, by trimming whitespace per normal PHP conventions and removing any trailing slashes. If it lacks a scheme, the file scheme is assumed and prepended.

Метод класса: Register{}

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->normalize_url( $url ): string;
$url(строка) (обязательный)
The URL to be normalized.

Код Register::normalize_url() WC 8.7.0

private function normalize_url( string $url ): string {
	$url = untrailingslashit( trim( $url ) );
	return ( new URL( $url ) )->get_url();
}