public function anchor($matches)
	{
		if (empty($matches))
		{
			return '';
		}

		$whole = $matches[0];
		$prtcl = rtrim($matches[1], ':');

		$url   = $matches[3];
		$url  .= (isset($matches[4])) ? $matches[4] : '';
		$url  .= (isset($matches[5])) ? $matches[5] : '';
		$url  .= (isset($matches[6])) ? $matches[6] : '';

		$prfx  = preg_replace('/^([\s]*)(.*)/i', "$1", $whole);
		$href  = trim($whole);
		if (substr($href, 0, 1) == '>')
		{
			$href  = ltrim($href, '>');
			$prfx .= '>';
		}

		$txt = $href;

		if ($prtcl == 'mailto')
		{
			$txt  = $url;
			$href = 'mailto:' . Str::obfuscate($url);
		}

		return $prfx . '<a class="ext-link" href="' . $href . '" rel="external">' . $txt . '</a>';
	}
public function anchor($matches)
	{
		if (empty($matches))
		{
			return '';
		}

		$whole = $matches[0];
		$prtcl = rtrim($matches[1], ':');

		$url   = $matches[3];
		$url  .= (isset($matches[4])) ? $matches[4] : '';
		$url  .= (isset($matches[5])) ? $matches[5] : '';
		$url  .= (isset($matches[6])) ? $matches[6] : '';

		$prfx  = preg_replace('/^([\s]*)(.*)/i', "$1", $whole);
		$href  = trim($whole);
		if (substr($href, 0, 1) == '>')
		{
			$href  = ltrim($href, '>');
			$prfx .= '>';
		}

		$txt = $href;

		if ($prtcl == 'mailto')
		{
			$txt  = $url;
			$href = 'mailto:' . Str::obfuscate($url);
		}

		return $prfx . '<a class="ext-link" href="' . $href . '" rel="external">' . $txt . '</a>';
	}
public function anchor ( $ matches ) { if ( empty ( $ matches ) ) { return '' ; } $ whole = $ matches [ 0 ] ; $ prtcl = rtrim ( $ matches [ 1 ] , ':' ) ; $ url = $ matches [ 3 ] ; $ url .= ( isset ( $ matches [ 4 ] ) ) ? $ matches [ 4 ] : '' ; $ url .= ( isset ( $ matches [ 5 ] ) ) ? $ matches [ 5 ] : '' ; $ url .= ( isset ( $ matches [ 6 ] ) ) ? $ matches [ 6 ] : '' ; $ prfx = preg_replace ( '/^([\s]*)(.*)/i' , "$1" , $ whole ) ; $ href = trim ( $ whole ) ; if ( substr ( $ href , 0 , 1 ) == '>' ) { $ href = ltrim ( $ href , '>' ) ; $ prfx .= '>' ; } $ txt = $ href ; if ( $ prtcl == 'mailto' ) { $ txt = $ url ; $ href = 'mailto:' . Str :: obfuscate ( $ url ) ; } return $ prfx . '<a class="ext-link" href="' . $ href . '" rel="external">' . $ txt . '</a>' ; }
Automatically links any strings matching a URL or email pattern

Link is pushed to internal array and placeholder returned
This is to ensure links aren't parsed twice. We put the links back in place
towards the end of parsing.

@param   array   $matches  Text matching link pattern
@return  string
Automatically links any strings matching a URL or email pattern