You are here

protected function Markdown::doAutoLinks in Markdown 7

* Parse Markdown automatic links to anchor HTML tags *

Parameters

string $text: * @return string

File

includes/Markdown.php, line 1613

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function doAutoLinks($text) {
  $text = preg_replace_callback('{<((https?|ftp|dict|tel):[^\'">\\s]+)>}i', array(
    $this,
    '_doAutoLinks_url_callback',
  ), $text);

  // Email addresses: <address@domain.foo>
  $text = preg_replace_callback('{
			<
			(?:mailto:)?
			(
				(?:
					[-!#$%&\'*+/=?^_`.{|}~\\w\\x80-\\xFF]+
				|
					".*?"
				)
				\\@
				(?:
					[-a-z0-9\\x80-\\xFF]+(\\.[-a-z0-9\\x80-\\xFF]+)*\\.[a-z]+
				|
					\\[[\\d.a-fA-F:]+\\]	# IPv4 & IPv6
				)
			)
			>
			}xi', array(
    $this,
    '_doAutoLinks_email_callback',
  ), $text);
  return $text;
}