protected function MarkdownExtra::_doAnchors_inline_callback in Markdown 7
* Callback for inline anchors *
Parameters
array $matches: * @return string
Overrides Markdown::_doAnchors_inline_callback
File
- includes/
MarkdownExtra.php, line 871
Class
- MarkdownExtra
- Markdown Extra Parser Class
Namespace
MichelfCode
protected function _doAnchors_inline_callback($matches) {
$whole_match = $matches[1];
$link_text = $this
->runSpanGamut($matches[2]);
$url = $matches[3] == '' ? $matches[4] : $matches[3];
$title =& $matches[7];
$attr = $this
->doExtraAttributes("a", $dummy =& $matches[8]);
// if the URL was of the form <s p a c e s> it got caught by the HTML
// tag parser and hashed. Need to reverse the process before using the URL.
$unhashed = $this
->unhash($url);
if ($unhashed != $url) {
$url = preg_replace('/^<(.*)>$/', '\\1', $unhashed);
}
$url = $this
->encodeURLAttribute($url);
$result = "<a href=\"{$url}\"";
if (isset($title)) {
$title = $this
->encodeAttribute($title);
$result .= " title=\"{$title}\"";
}
$result .= $attr;
$link_text = $this
->runSpanGamut($link_text);
$result .= ">{$link_text}</a>";
return $this
->hashPart($result);
}