/**
* Method used as a callback with the regular expression code that parses
* text and creates links to other issues.
*
* @param array $matches Regular expression matches
* @return string The link to the appropriate issue
*/
public static function LinkFilter_issues($matches)
{
$issue_id = $matches['issue_id'];
// check if the issue is still open
if (Issue::isClosed($issue_id)) {
$class = 'closed';
} else {
$class = '';
}
$issue_title = Issue::getTitle($issue_id);
$link_title = htmlspecialchars("issue {$issue_id} - {$issue_title}");
// use named capture 'match' if present
$match = isset($matches['match']) ? $matches['match'] : "issue {$issue_id}";
return "<a title=\"{$link_title}\" class=\"{$class}\" href=\"view.php?id={$matches['issue_id']}\">{$match}</a>";
}