Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106206847
DoorkeeperRemarkupRuleJIRA.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Mar 23, 15:01
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Mar 25, 15:01 (2 d)
Engine
blob
Format
Raw Data
Handle
25038804
Attached To
rPH Phabricator
DoorkeeperRemarkupRuleJIRA.php
View Options
<?php
final
class
DoorkeeperRemarkupRuleJIRA
extends
DoorkeeperRemarkupRule
{
public
function
apply
(
$text
)
{
return
preg_replace_callback
(
'@(https?://
\S
+?)/browse/([A-Z]+-[1-9]
\d
*)@'
,
array
(
$this
,
'markupJIRALink'
),
$text
);
}
public
function
markupJIRALink
(
$matches
)
{
$match_domain
=
$matches
[
1
];
$match_issue
=
$matches
[
2
];
// TODO: When we support multiple instances, deal with them here.
$provider
=
PhabricatorJIRAAuthProvider
::
getJIRAProvider
();
if
(!
$provider
)
{
return
$matches
[
0
];
}
$jira_base
=
$provider
->
getJIRABaseURI
();
if
(
$match_domain
!=
rtrim
(
$jira_base
,
'/'
))
{
return
$matches
[
0
];
}
return
$this
->
addDoorkeeperTag
(
array
(
'href'
=>
$matches
[
0
],
'tag'
=>
array
(
'ref'
=>
array
(
DoorkeeperBridgeJIRA
::
APPTYPE_JIRA
,
$provider
->
getProviderDomain
(),
DoorkeeperBridgeJIRA
::
OBJTYPE_ISSUE
,
$match_issue
,
),
),
));
}
}
Event Timeline
Log In to Comment