SimplePie_IRI::parse_iri

Advertisement

Summery Summery

Parse an IRI into scheme/authority/path/query/fragment segments

Syntax Syntax

SimplePie_IRI::parse_iri( string $iri )

Parameters Parameters

$iri

(Required)

Return Return

(array)

Source Source

File: wp-includes/SimplePie/IRI.php

		if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match))
		{
			if ($match[1] === '')
			{
				$match['scheme'] = null;
			}
			if (!isset($match[3]) || $match[3] === '')
			{
				$match['authority'] = null;
			}
			if (!isset($match[5]))
			{
				$match['path'] = '';
			}
			if (!isset($match[6]) || $match[6] === '')
			{
				$match['query'] = null;
			}
			if (!isset($match[8]) || $match[8] === '')
			{
				$match['fragment'] = null;
			}
			return $match;
		}

		// This can occur when a paragraph is accidentally parsed as a URI
		return false;
	}

	/**
	 * Remove dot segments from a path
	 *
	 * @param string $input

Advertisement

Advertisement

Leave a Reply