Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F441599
PhabricatorRemarkupRulePhriction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
992 B
Referenced Files
None
Subscribers
None
PhabricatorRemarkupRulePhriction.php
View Options
<?php
/**
* @group markup
*/
final
class
PhabricatorRemarkupRulePhriction
extends
PhutilRemarkupRule
{
public
function
apply
(
$text
)
{
return
preg_replace_callback
(
'@
\B\\
[
\\
[([^|
\\
]]+)(?:
\\
|([^
\\
]]+))?
\\
]
\\
]
\B
@U'
,
array
(
$this
,
'markupDocumentLink'
),
$text
);
}
public
function
markupDocumentLink
(
$matches
)
{
$link
=
trim
(
$matches
[
1
]);
$name
=
trim
(
idx
(
$matches
,
2
,
$link
));
$name
=
explode
(
'/'
,
trim
(
$name
,
'/'
));
$name
=
end
(
$name
);
$uri
=
new
PhutilURI
(
$link
);
$slug
=
$uri
->
getPath
();
$fragment
=
$uri
->
getFragment
();
$slug
=
PhabricatorSlug
::
normalize
(
$slug
);
$slug
=
PhrictionDocument
::
getSlugURI
(
$slug
);
$href
=
(
string
)
id
(
new
PhutilURI
(
$slug
))->
setFragment
(
$fragment
);
return
$this
->
getEngine
()->
storeText
(
phutil_render_tag
(
'a'
,
array
(
'href'
=>
$href
,
'class'
=>
'phriction-link'
,
),
phutil_escape_html
(
$name
)));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 7:38 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
64522
Default Alt Text
PhabricatorRemarkupRulePhriction.php (992 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment