Requests_IRI::set_scheme() WordPress Method

The Requests_IRI::set_scheme() function can be used to set or change the scheme part of an IRI. The new scheme will be validated according to the RFC 3986 specification. If the new scheme is not valid, a Requests_Exception will be thrown.

Requests_IRI::set_scheme( string $scheme ) #

Set the scheme. Returns true on success, false on failure (if there are any invalid characters).


Parameters

$scheme

(string)(Required)


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/Requests/IRI.php

	protected function set_scheme($scheme) {
		if ($scheme === null) {
			$this->scheme = null;
		}
		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
			$this->scheme = null;
			return false;
		}
		else {
			$this->scheme = strtolower($scheme);
		}
		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.