Created
December 20, 2012 08:40
-
-
Save anonymous/4343847 to your computer and use it in GitHub Desktop.
Convert ticket IDs (Redmine => GitHub)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arrMap = array(1=>17, 34=>98); | |
$strBody = ' | |
Nina Gerling said On Thu, Dec 30. 2010 | |
I\'d recomment using the headline like I recommended in ticket #326: | |
my comment on this, also watch out on #34 | |
'; | |
$strBody = preg_replace_callback('/#([0-9]+)/', 'replaceTickets', $strBody); | |
function replaceTickets($matches) | |
{ | |
global $arrMap; | |
if (isset($arrMap[$matches[1]])) | |
{ | |
return '#'.$arrMap[$matches[1]]; | |
} | |
else | |
{ | |
return 'http://www.contao-forge.org/issues/'.$matches[1]; | |
} | |
} | |
var_dump($strBody); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment