Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97584618
PhabricatorAudioDocumentEngine.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
Sun, Jan 5, 11:41
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 11:41 (2 d)
Engine
blob
Format
Raw Data
Handle
23431122
Attached To
rPH Phabricator
PhabricatorAudioDocumentEngine.php
View Options
<?php
final
class
PhabricatorAudioDocumentEngine
extends
PhabricatorDocumentEngine
{
const
ENGINEKEY
=
'audio'
;
public
function
getViewAsLabel
(
PhabricatorDocumentRef
$ref
)
{
return
pht
(
'View as Audio'
);
}
protected
function
getDocumentIconIcon
(
PhabricatorDocumentRef
$ref
)
{
return
'fa-file-sound-o'
;
}
protected
function
getByteLengthLimit
()
{
return
null
;
}
protected
function
canRenderDocumentType
(
PhabricatorDocumentRef
$ref
)
{
$file
=
$ref
->
getFile
();
if
(
$file
)
{
return
$file
->
isAudio
();
}
$viewable_types
=
PhabricatorEnv
::
getEnvConfig
(
'files.viewable-mime-types'
);
$viewable_types
=
array_keys
(
$viewable_types
);
$audio_types
=
PhabricatorEnv
::
getEnvConfig
(
'files.audio-mime-types'
);
$audio_types
=
array_keys
(
$audio_types
);
return
$ref
->
hasAnyMimeType
(
$viewable_types
)
&&
$ref
->
hasAnyMimeType
(
$audio_types
);
}
protected
function
newDocumentContent
(
PhabricatorDocumentRef
$ref
)
{
$file
=
$ref
->
getFile
();
if
(
$file
)
{
$source_uri
=
$file
->
getViewURI
();
}
else
{
throw
new
PhutilMethodNotImplementedException
();
}
$mime_type
=
$ref
->
getMimeType
();
$audio
=
phutil_tag
(
'audio'
,
array
(
'controls'
=>
'controls'
,
),
phutil_tag
(
'source'
,
array
(
'src'
=>
$source_uri
,
'type'
=>
$mime_type
,
)));
$container
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'document-engine-audio'
,
),
$audio
);
return
$container
;
}
}
Event Timeline
Log In to Comment