function string_process_bug_link( $p_string, $p_include_anchor = true, $p_detail_info = true, $p_fqdn = false ) { $t_commit_regexp = config_get( 'source_control_regexp' ); $t_issue_number_regexp = config_get( 'source_control_issue_number_regexp' ); $t_comment = ''; $t_matches = array(); $t_lines = 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 ) ) { $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_bug_id = $t_matches[0][$i]; if ( !$p_include_anchor ) { $t_line = str_replace($t_bug_id , string_get_bug_view_url_with_fqdn( $t_bug_id , null ), $t_line); } elseif(bug_exists( $t_bug_id )) { $t_line = str_replace($t_bug_id , string_get_bug_view_link( $t_bug_id , null, $p_detail_info, $p_fqdn ), $t_line); } } } } $t_comment .= $t_line.chr(10); } return $t_comment; }