function MarkdownExtra_Parser::_doImages_reference_callback in Markdown 6
Overrides Markdown_Parser::_doImages_reference_callback
File
- ./
markdown.php, line 2544
Class
Code
function _doImages_reference_callback($matches) {
$whole_match = $matches[1];
$alt_text = $matches[2];
$link_id = strtolower($matches[3]);
if ($link_id == "") {
$link_id = strtolower($alt_text);
# for shortcut links like ![this][].
}
$alt_text = $this
->encodeAttribute($alt_text);
if (isset($this->urls[$link_id])) {
$url = $this
->encodeAttribute($this->urls[$link_id]);
$result = "<img src=\"{$url}\" alt=\"{$alt_text}\"";
if (isset($this->titles[$link_id])) {
$title = $this->titles[$link_id];
$title = $this
->encodeAttribute($title);
$result .= " title=\"{$title}\"";
}
if (isset($this->ref_attr[$link_id])) {
$result .= $this->ref_attr[$link_id];
}
$result .= $this->empty_element_suffix;
$result = $this
->hashPart($result);
}
else {
# If there's no such link ID, leave intact:
$result = $whole_match;
}
return $result;
}