[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DoorkeeperRemarkupRuleJIRA 4 extends DoorkeeperRemarkupRule { 5 6 public function apply($text) { 7 return preg_replace_callback( 8 '@(https?://\S+?)/browse/([A-Z]+-[1-9]\d*)@', 9 array($this, 'markupJIRALink'), 10 $text); 11 } 12 13 public function markupJIRALink($matches) { 14 $match_domain = $matches[1]; 15 $match_issue = $matches[2]; 16 17 // TODO: When we support multiple instances, deal with them here. 18 $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); 19 if (!$provider) { 20 return $matches[0]; 21 } 22 23 24 $jira_base = $provider->getJIRABaseURI(); 25 if ($match_domain != rtrim($jira_base, '/')) { 26 return $matches[0]; 27 } 28 29 return $this->addDoorkeeperTag( 30 array( 31 'href' => $matches[0], 32 'tag' => array( 33 'ref' => array( 34 DoorkeeperBridgeJIRA::APPTYPE_JIRA, 35 $provider->getProviderDomain(), 36 DoorkeeperBridgeJIRA::OBJTYPE_ISSUE, 37 $match_issue, 38 ), 39 ), 40 )); 41 } 42 43 44 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |