Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98083929
DoorkeeperRemarkupRule.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
Thu, Jan 9, 15:04
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 11, 15:04 (2 d)
Engine
blob
Format
Raw Data
Handle
23501633
Attached To
rPH Phabricator
DoorkeeperRemarkupRule.php
View Options
<?php
abstract
class
DoorkeeperRemarkupRule
extends
PhutilRemarkupRule
{
const
KEY_TAGS
=
'doorkeeper.tags'
;
public
function
getPriority
()
{
return
350.0
;
}
protected
function
addDoorkeeperTag
(
array
$spec
)
{
$key
=
self
::
KEY_TAGS
;
$engine
=
$this
->
getEngine
();
$token
=
$engine
->
storeText
(
get_class
(
$this
));
$tags
=
$engine
->
getTextMetadata
(
$key
,
array
());
$tags
[]
=
array
(
'token'
=>
$token
,
)
+
$spec
+
array
(
'extra'
=>
array
(),
);
$engine
->
setTextMetadata
(
$key
,
$tags
);
return
$token
;
}
public
function
didMarkupText
()
{
$key
=
self
::
KEY_TAGS
;
$engine
=
$this
->
getEngine
();
$tags
=
$engine
->
getTextMetadata
(
$key
,
array
());
if
(!
$tags
)
{
return
;
}
$refs
=
array
();
foreach
(
$tags
as
$spec
)
{
$tag_id
=
celerity_generate_unique_node_id
();
$refs
[]
=
array
(
'id'
=>
$tag_id
,
)
+
$spec
[
'tag'
];
if
(
$this
->
getEngine
()->
isTextMode
())
{
$view
=
$spec
[
'href'
];
}
else
{
$view
=
id
(
new
PhabricatorTagView
())
->
setID
(
$tag_id
)
->
setName
(
$spec
[
'href'
])
->
setHref
(
$spec
[
'href'
])
->
setType
(
PhabricatorTagView
::
TYPE_OBJECT
)
->
setExternal
(
true
);
}
$engine
->
overwriteStoredText
(
$spec
[
'token'
],
$view
);
}
Javelin
::
initBehavior
(
'doorkeeper-tag'
,
array
(
'tags'
=>
$refs
));
$engine
->
setTextMetadata
(
$key
,
array
());
}
}
Event Timeline
Log In to Comment