- Timestamp:
- 04/08/2018 11:43:27 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/slack/trac/comment-handler.php
r7041 r7064 37 37 $line = array_shift( $lines ); 38 38 if ( 0 === strpos( $line, 'X-Trac-Ticket-URL:' ) ) { 39 // X-Trac-Ticket-URL: https://core.trac.wordpress.org/ticket/12345#comment:139 $comment_id = 0; 40 40 list( , $comment_url ) = explode( ': ', $line ); 41 list( $ticket_url, $comment_id ) = explode( '#comment:', $comment_url ); 41 42 // Get ticket URL, attachment notifcations have no specific URL. 43 if ( false !== strpos( $line, '#comment:' ) ) { 44 // X-Trac-Ticket-URL: https://core.trac.wordpress.org/ticket/12345#comment:1 45 list( $ticket_url, $comment_id ) = explode( '#comment:', $comment_url ); 46 } else { 47 // X-Trac-Ticket-URL: https://core.trac.wordpress.org/ticket/12345 48 $ticket_url = $comment_url; 49 } 50 42 51 list( $trac_url, $ticket_id ) = explode( '/ticket/', $ticket_url ); 43 52 … … 167 176 if ( $has_changes ) { 168 177 while ( $lines && '' !== current( $lines ) ) { 169 $changes[] = preg_replace( '~^ \* (.*?): ~', '_*$1:*_ ', array_shift( $lines ) ); 178 $line = array_shift( $lines ); 179 180 if ( preg_match( '~Attachment "([^"]+)" (added|removed)\.$~', $line, $matches ) ) { // * Attachment "test.txt" added/removed. 181 $changes[] = "_*attachment:*_ `{$matches[1]}` {$matches[2]}"; 182 } else { // * status: assigned => closed 183 $changes[] = preg_replace( '~^ \* (.*?): ~', '_*$1:*_ ', $line ); 184 } 170 185 } 171 186 }
Note: See TracChangeset
for help on using the changeset viewer.