Snoopy::_striplinks()publicWP 1.0

Method of the class: Snoopy{}

No Hooks.

Return

null. Nothing.

Usage

$Snoopy = new Snoopy();
$Snoopy->_striplinks( $document );
$document (required)
-

Snoopy::_striplinks() code WP 6.1.1

function _striplinks($document)
{
	preg_match_all("'<\s*a\s.*?href\s*=\s*			# find <a href=
					([\"\'])?					# find single or double quote
					(?(1) (.*?)\\1 | ([^\s\>]+))		# if quote found, match up to next matching
												# quote, otherwise match up to next space
					'isx",$document,$links);


	// catenate the non-empty matches from the conditional subpattern

	foreach ( $links[2] as $key => $val )
	{
		if(!empty($val))
			$match[] = $val;
	}

	foreach ( $links[3] as $key => $val )
	{
		if(!empty($val))
			$match[] = $val;
	}

	// return the links
	return $match;
}