* @copyright Copyright (c) 2010 Christopher Han * @package GitPHP * @subpackage Smarty * * @param string $text text to find bug references in * @param string $pattern search pattern * @param string $link link pattern * @return string text with bug references linked */ function smarty_modifier_buglink($text, $pattern = null, $link = null) { if (empty($text) || empty($pattern) || empty($link)) return $text; $fullLink = '${0}'; return preg_replace($pattern, $fullLink, $text); }