Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F179900
PhabricatorRemarkupGhcTracRule.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
epriestley
Jul 22 2014, 4:25 PM
2014-07-22 16:25:28 (UTC+0)
Size
925 B
Referenced Files
None
Subscribers
None
PhabricatorRemarkupGhcTracRule.php
View Options
<?php
/**
* Looks for references to GHC Trac issues and links to them as a Remarkup rule.
*/
final
class
PhabricatorRemarkupGhcTracRule
extends
PhabricatorRemarkupCustomInlineRule
{
public
function
getPriority
()
{
return
200.0
;
}
public
function
apply
(
$text
)
{
return
preg_replace_callback
(
'/
\B
#(
\d
+)/'
,
array
(
$this
,
'markupInlineTracLink'
),
$text
);
}
public
function
markupInlineTracLink
(
array
$matches
)
{
// Change this to your Trac install.
$uri
=
'http://your.trac.install.com/whatever/'
.
$matches
[
1
];
$link
=
phutil_tag
(
'a'
,
array
(
'href'
=>
$uri
,
'style'
=>
'font-weight: bold;'
,
),
'Trac #'
.
$matches
[
1
]);
$engine
=
$this
->
getEngine
();
return
$engine
->
storeText
(
$link
);
}
}
// Local Variables:
// fill-column: 80
// indent-tabs-mode: nil
// c-basic-offset: 2
// buffer-file-coding-system: utf-8-unix
// End:
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/gc/36/cv4eoc5leqnkkyn6
Default Alt Text
PhabricatorRemarkupGhcTracRule.php (925 B)
Attached To
Mode
P1209 PhabricatorRemarkupGhcTracRule.php
Attached
Detach File
Event Timeline
Log In to Comment