1: <?php
2: /**
3: * Displays message signatures marked by a '-- ' in the style of the CSS class
4: * "signature".
5: *
6: * Copyright 2004-2012 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (LGPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10: *
11: * @author Jan Schneider <jan@horde.org>
12: * @category Horde
13: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
14: * @package Text_Filter
15: */
16: class Horde_Text_Filter_Dimsignature extends Horde_Text_Filter_Base
17: {
18: /**
19: * Executes any code necessary after applying the filter patterns.
20: *
21: * @param string $text The text after the filtering.
22: *
23: * @return string The modified text.
24: */
25: public function postProcess($text)
26: {
27: $parts = preg_split('/(\n--\s*(?:<br \/>)?\r?\n.*?)(?=<\/?(?:div|span)|$\s)/is', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
28: $text = '';
29:
30: while (count($parts)) {
31: $text .= array_shift($parts);
32: if (count($parts)) {
33: $text .= '<span class="signature">' . array_shift($parts) . '</span>';
34: }
35: }
36:
37: return $text;
38: }
39:
40: }
41: