function string_process_bug_link( $p_string, $p_include_anchor = true, $p_detail_info = true, $p_fqdn = false ) { $t_tag = config_get( 'bug_link_tag' ); # bail if the link tag is blank if ( '' == $t_tag ) { return $p_string; } $t_commit_regexp = config_get( 'source_control_regexp' ); $t_issue_number_regexp = config_get( 'source_control_issue_number_regexp' ); $t_comment = ''; $t_issues = array(); $t_fixed_issues = array(); $t_lines = split(chr(10), $p_string); foreach ($t_lines as $t_line) { if ( preg_match_all( $t_commit_regexp, $t_line, $t_matches ) ) { # now extract all the issue numbers $t_issue_full_text = $t_matches[0][0]; if ( preg_match_all( $t_issue_number_regexp, $t_issue_full_text, $t_matches ) ) { for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) { $t_issues[] = $t_matches[0][$i]; if ( $p_include_anchor ) { $t_line = str_replace($t_matches[0][$i], string_get_bug_view_link( $t_matches[0][$i], null, $p_detail_info, $p_fqdn ), $t_line); } else { $t_line = str_replace($t_matches[0][$i], string_get_bug_view_url_with_fqdn( $t_bug_id, null ), $t_line); } } } } $t_comment .= $t_line.chr(10); } return $t_comment; }