Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1157
CustomInlineJIRA5Rule.php
Active
Public
Actions
Authored by
epriestley
on May 22 2014, 2:45 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F158899: CustomInlineJIRA5Rule.php
May 22 2014, 2:45 PM
2014-05-22 14:45:55 (UTC+0)
Subscribers
hartman
<?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
edited the content of this paste.
(Show Details)
May 22 2014, 2:45 PM
2014-05-22 14:45:55 (UTC+0)
epriestley
changed the title of this paste from untitled to
CustomInlineJIRA5Rule.php
.
epriestley
updated the paste's language from
autodetect
to
autodetect
.
epriestley
mentioned this in
T11980: Links to external systems
.
Dec 11 2016, 4:56 PM
2016-12-11 16:56:39 (UTC+0)
Log In to Comment