Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96156366
PasteEmbedView.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, Dec 23, 06:45
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 06:45 (2 d)
Engine
blob
Format
Raw Data
Handle
23135711
Attached To
rPH Phabricator
PasteEmbedView.php
View Options
<?php
final
class
PasteEmbedView
extends
AphrontView
{
private
$paste
;
private
$handle
;
private
$highlights
=
array
();
private
$lines
=
24
;
public
function
setPaste
(
PhabricatorPaste
$paste
)
{
$this
->
paste
=
$paste
;
return
$this
;
}
public
function
setHandle
(
PhabricatorObjectHandle
$handle
)
{
$this
->
handle
=
$handle
;
return
$this
;
}
public
function
setHighlights
(
array
$highlights
)
{
$this
->
highlights
=
$highlights
;
return
$this
;
}
public
function
setLines
(
$lines
)
{
$this
->
lines
=
$lines
;
return
$this
;
}
public
function
render
()
{
if
(!
$this
->
paste
)
{
throw
new
PhutilInvalidStateException
(
'setPaste'
);
}
$lines
=
phutil_split_lines
(
$this
->
paste
->
getContent
());
require_celerity_resource
(
'paste-css'
);
$link
=
phutil_tag
(
'a'
,
array
(
'href'
=>
'/P'
.
$this
->
paste
->
getID
(),
),
$this
->
handle
->
getFullName
());
$head
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'paste-embed-head'
,
),
$link
);
$body_attributes
=
array
(
'class'
=>
'paste-embed-body'
);
if
(
$this
->
lines
!=
null
)
{
$body_attributes
[
'style'
]
=
'max-height: '
.
$this
->
lines
*
(
1.15
).
'em;'
;
}
$body
=
phutil_tag
(
'div'
,
$body_attributes
,
id
(
new
PhabricatorSourceCodeView
())
->
setLines
(
$lines
)
->
setHighlights
(
$this
->
highlights
)
->
disableHighlightOnClick
());
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'paste-embed'
),
array
(
$head
,
$body
));
}
}
Event Timeline
Log In to Comment