Remove product literal strings in "pht()", part 5
[phabricator.git] / src / applications / files / document / PhabricatorAudioDocumentEngine.php
blob859f16762744af7bc86e894a687674fb06bdb935
1 <?php
3 final class PhabricatorAudioDocumentEngine
4 extends PhabricatorDocumentEngine {
6 const ENGINEKEY = 'audio';
8 public function getViewAsLabel(PhabricatorDocumentRef $ref) {
9 return pht('View as Audio');
12 protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) {
13 return 'fa-file-sound-o';
16 protected function getByteLengthLimit() {
17 return null;
20 protected function canRenderDocumentType(PhabricatorDocumentRef $ref) {
21 $file = $ref->getFile();
22 if ($file) {
23 return $file->isAudio();
26 $viewable_types = PhabricatorEnv::getEnvConfig('files.viewable-mime-types');
27 $viewable_types = array_keys($viewable_types);
29 $audio_types = PhabricatorEnv::getEnvConfig('files.audio-mime-types');
30 $audio_types = array_keys($audio_types);
32 return
33 $ref->hasAnyMimeType($viewable_types) &&
34 $ref->hasAnyMimeType($audio_types);
37 protected function newDocumentContent(PhabricatorDocumentRef $ref) {
38 $file = $ref->getFile();
39 if ($file) {
40 $source_uri = $file->getViewURI();
41 } else {
42 throw new PhutilMethodNotImplementedException();
45 $mime_type = $ref->getMimeType();
47 $audio = phutil_tag(
48 'audio',
49 array(
50 'controls' => 'controls',
52 phutil_tag(
53 'source',
54 array(
55 'src' => $source_uri,
56 'type' => $mime_type,
57 )));
59 $container = phutil_tag(
60 'div',
61 array(
62 'class' => 'document-engine-audio',
64 $audio);
66 return $container;