WordPress\AiClient\Files\DTO

File::isUrlprivateWP 0.1.0

Checks if a string is a valid URL.

Method of the class: File{}

No Hooks.

Returns

true|false. True if the string is a URL.

Usage

// private - for code of main (parent) class only
$result = $this->isUrl( $string ): bool;
$string(string) (required)
The string to check.

Changelog

Since 0.1.0 Introduced.

File::isUrl() code WP 7.0

private function isUrl(string $string): bool
{
    return filter_var($string, \FILTER_VALIDATE_URL) !== \false && preg_match('/^https?:\/\//i', $string);
}