Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106650388
PhabricatorPDFDocumentEngine.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
Sat, Mar 29, 09:46
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Mar 31, 10:46 (2 d)
Engine
blob
Format
Raw Data
Handle
25242660
Attached To
rPH Phabricator
PhabricatorPDFDocumentEngine.php
View Options
<?php
final
class
PhabricatorPDFDocumentEngine
extends
PhabricatorDocumentEngine
{
const
ENGINEKEY
=
'pdf'
;
public
function
getViewAsLabel
(
PhabricatorDocumentRef
$ref
)
{
return
pht
(
'View as PDF'
);
}
protected
function
getDocumentIconIcon
(
PhabricatorDocumentRef
$ref
)
{
return
'fa-file-pdf-o'
;
}
protected
function
canRenderDocumentType
(
PhabricatorDocumentRef
$ref
)
{
// Since we just render a link to the document anyway, we don't need to
// check anything fancy in config to see if the MIME type is actually
// viewable.
return
$ref
->
hasAnyMimeType
(
array
(
'application/pdf'
,
));
}
protected
function
newDocumentContent
(
PhabricatorDocumentRef
$ref
)
{
$viewer
=
$this
->
getViewer
();
$file
=
$ref
->
getFile
();
if
(
$file
)
{
$source_uri
=
$file
->
getViewURI
();
}
else
{
throw
new
PhutilMethodNotImplementedException
();
}
$name
=
$ref
->
getName
();
$length
=
$ref
->
getByteLength
();
$link
=
id
(
new
PhabricatorFileLinkView
())
->
setViewer
(
$viewer
)
->
setFileName
(
$name
)
->
setFileViewURI
(
$source_uri
)
->
setFileViewable
(
true
)
->
setFileSize
(
phutil_format_bytes
(
$length
));
$container
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'document-engine-pdf'
,
),
$link
);
return
$container
;
}
}
Event Timeline
Log In to Comment