1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22:
23: class IMP_Mime_Viewer_Enriched extends Horde_Mime_Viewer_Enriched
24: {
25: 26: 27: 28: 29:
30: protected function _render()
31: {
32: $ret = parent::_render();
33: if (!empty($ret)) {
34: reset($ret);
35: $ret[key($ret)]['data'] = $this->_IMPformat($ret[key($ret)]['data']);
36: }
37: return $ret;
38: }
39:
40: 41: 42: 43: 44:
45: protected function _renderInline()
46: {
47: $ret = parent::_renderInline();
48: if (!empty($ret)) {
49: reset($ret);
50: $ret[key($ret)]['data'] = $this->_IMPformat($ret[key($ret)]['data']);
51: }
52: return $ret;
53: }
54:
55: 56: 57: 58: 59: 60: 61:
62: protected function _IMPformat($text)
63: {
64:
65: if ($GLOBALS['prefs']->getValue('highlight_text')) {
66: $text = implode("\n", preg_replace('|^(\s*>.+)$|', '<span class="quoted1">\1</span>', explode("\n", $text)));
67: $indent = 1;
68: while (preg_match('|>(\s?>){' . $indent . '}|', $text)) {
69: $text = implode("\n", preg_replace('|^<span class="quoted' . ((($indent - 1) % 5) + 1) . '">(\s*>(\s?>){' . $indent . '}.+)$|', '<span class="quoted' . (($indent % 5) + 1) . '">\1', explode("\n", $text)));
70: ++$indent;
71: }
72: }
73:
74:
75: if ($GLOBALS['prefs']->getValue('dim_signature')) {
76: $parts = preg_split('|(\n--\s*\n)|', $text, 2, PREG_SPLIT_DELIM_CAPTURE);
77: $text = array_shift($parts);
78: if (count($parts)) {
79: $text .= '<span class="signature">' . $parts[0] .
80: preg_replace('|class="[^"]+"|', 'class="signature-fixed"', $parts[1]) .
81: '</span>';
82: }
83: }
84:
85:
86: return IMP::filterText($text);
87: }
88:
89: }
90: