Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F459000
DoorkeeperRemarkupRuleJIRA.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
=
PhabricatorAuthProviderOAuth1JIRA
::
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
,
),
),
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 1:10 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71765
Default Alt Text
DoorkeeperRemarkupRuleJIRA.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment