Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F548056
PasteEmbedView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:43 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
102527
Default Alt Text
PasteEmbedView.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment