1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
24: class IMP_Mime_Viewer_Audio extends Horde_Mime_Viewer_Audio
25: {
26: 27: 28: 29: 30:
31: protected $_capability = array(
32: 'full' => true,
33: 'info' => true,
34: 'inline' => false,
35: 'raw' => false
36: );
37:
38: 39: 40: 41: 42:
43: protected function _renderInfo()
44: {
45: $mime_id = $this->_mimepart->getMimeId();
46: $headers = Horde_Mime_Headers::parseHeaders($this->getConfigParam('imp_contents')->getBodyPart($mime_id, array(
47: 'length' => 0,
48: 'mimeheaders' => true,
49: 'stream' => true
50: ))->data);
51:
52: if (($duration = $headers->getValue('content-duration')) === null) {
53: return array();
54: }
55:
56: $text = array();
57:
58: if ($minutes = floor($duration / 60)) {
59: $text[] = sprintf(
60: ngettext(_("%d minute"), _("%d minutes"), $minutes),
61: $minutes
62: );
63: }
64:
65: if ($seconds = ($duration % 60)) {
66: $text[] = sprintf(
67: ngettext(_("%d second"), _("%d seconds"), $seconds),
68: $seconds
69: );
70: }
71:
72: $status = new IMP_Mime_Status(
73: sprintf(_("This audio file is reported to be %s in length."), implode(' ', $text))
74: );
75: $status->icon('mime/audio.png');
76:
77: return array(
78: $this->_mimepart->getMimeId() => array(
79: 'data' => '',
80: 'status' => $status,
81: 'type' => 'text/html; charset=UTF-8'
82: )
83: );
84: }
85:
86: }
87: