Requests_IRI::is_valid() WordPress Method

The Requests_IRI::is_valid() function checks whether an IRI is valid. An IRI is a sequence of characters that conforms to the IRI standard. If the IRI is valid, the function returns true. Otherwise, it returns false.

Requests_IRI::is_valid() #

Check if the object represents a valid IRI. This needs to be done on each call as some things change depending on another part of the IRI.


Return

(bool)


Top ↑

Source

File: wp-includes/Requests/IRI.php

	public function is_valid() {
		$isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
		if ($this->ipath !== '' &&
			(
				$isauthority && $this->ipath[0] !== '/' ||
				(
					$this->scheme === null &&
					!$isauthority &&
					strpos($this->ipath, ':') !== false &&
					(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
				)
			)
		) {
			return false;
		}

		return true;
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.