Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92986769
PhrictionContent.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
Mon, Nov 25, 09:25
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 09:25 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22550572
Attached To
rPH Phabricator
PhrictionContent.php
View Options
<?php
/**
* @task markup Markup Interface
*
* @group phriction
*/
final
class
PhrictionContent
extends
PhrictionDAO
implements
PhabricatorMarkupInterface
{
const
MARKUP_FIELD_BODY
=
'markup:body'
;
protected
$id
;
protected
$documentID
;
protected
$version
;
protected
$authorPHID
;
protected
$title
;
protected
$slug
;
protected
$content
;
protected
$description
;
protected
$changeType
;
protected
$changeRef
;
public
function
renderContent
(
PhabricatorUser
$viewer
)
{
return
PhabricatorMarkupEngine
::
renderOneObject
(
$this
,
self
::
MARKUP_FIELD_BODY
,
$viewer
);
}
/* -( Markup Interface )--------------------------------------------------- */
/**
* @task markup
*/
public
function
getMarkupFieldKey
(
$field
)
{
if
(
$this
->
shouldUseMarkupCache
(
$field
))
{
$id
=
$this
->
getID
();
}
else
{
$id
=
PhabricatorHash
::
digest
(
$this
->
getMarkupText
(
$field
));
}
return
"phriction:{$field}:{$id}"
;
}
/**
* @task markup
*/
public
function
getMarkupText
(
$field
)
{
return
$this
->
getContent
();
}
/**
* @task markup
*/
public
function
newMarkupEngine
(
$field
)
{
return
PhabricatorMarkupEngine
::
newPhrictionMarkupEngine
();
}
/**
* @task markup
*/
public
function
didMarkupText
(
$field
,
$output
,
PhutilMarkupEngine
$engine
)
{
$toc
=
PhutilRemarkupEngineRemarkupHeaderBlockRule
::
renderTableOfContents
(
$engine
);
if
(
$toc
)
{
$toc
=
hsprintf
(
'<div class="phabricator-remarkup-toc">'
.
'<div class="phabricator-remarkup-toc-header">%s</div>'
.
'%s'
.
'</div>'
,
pht
(
'Table of Contents'
),
$toc
);
}
return
hsprintf
(
'<div class="phabricator-remarkup">%s%s</div>'
,
$toc
,
$output
);
}
/**
* @task markup
*/
public
function
shouldUseMarkupCache
(
$field
)
{
return
(
bool
)
$this
->
getID
();
}
}
Event Timeline
Log In to Comment