1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: class IMP_Mime_Viewer_Smil extends Horde_Mime_Viewer_Smil
17: {
18: 19: 20: 21: 22: 23: 24:
25: protected function _startElement($parser, $name, $attrs)
26: {
27: switch ($name) {
28: case 'IMG':
29: if (isset($attrs['SRC']) &&
30: (($rp = $this->_getRelatedLink($attrs['SRC'])) !== false)) {
31: $this->_content .= '<img src="' . $this->getConfigParam('imp_contents')->urlView($rp, 'view_attach', array('params' => array('imp_img_view' => 'data'))) . '" /><br />';
32: }
33: break;
34:
35: case 'TEXT':
36: if (isset($attrs['SRC']) &&
37: (($rp = $this->_getRelatedLink($attrs['SRC'])) !== false)) {
38: $this->_content .= htmlspecialchars($rp->getContents()) . '<br />';
39: }
40: break;
41: }
42: }
43:
44: 45: 46: 47: 48: 49: 50:
51: protected function _getRelatedLink($cid)
52: {
53: if ($related_part = $this->getConfigParam('imp_contents')->findMimeType($this->_mimepart->getMimeId(), 'multipart/related')) {
54: $key = array_search('<' . trim($cid, '<>') . '>', $related_part->getMetadata('related_cids'));
55: if ($key !== false) {
56: return $this->getConfigParam('imp_contents')->getMIMEPart($key);
57: }
58: }
59:
60: return false;
61: }
62:
63: }
64: