Page MenuHomePhabricator
Paste P1157

CustomInlineJIRA5Rule.php
ActivePublic

Authored by epriestley on May 22 2014, 2:45 PM.
Tags
None
Referenced Files
F158899: CustomInlineJIRA5Rule.php
May 22 2014, 2:45 PM
Subscribers
<?php
final class CustomInlineJIRA5Rule extends PhabricatorRemarkupCustomInlineRule {
public function apply($text) {
return preg_replace_callback(
'/\b([A-Z]+-\d+)/',
array($this, 'markupInlineJIRALink'),
$text);
}
public function markupInlineJIRALink(array $matches) {
// Change this to your JIRA install.
$uri = 'http://your.jira.install.com/browse/'.$matches[1];
$link = phutil_tag(
'a',
array(
'href' => $uri,
'style' => 'font-weight: bold;',
),
$matches[1]);
$engine = $this->getEngine();
return $engine->storeText($link);
}
}

Event Timeline

epriestley changed the title of this paste from untitled to CustomInlineJIRA5Rule.php.
epriestley updated the paste's language from autodetect to autodetect.