1: <?php
2: /**
3: * Highlights simple markup as used in emails or usenet postings.
4: *
5: * Copyright 2004-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (LGPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
9: *
10: * @author Jan Schneider <jan@horde.org>
11: * @category Horde
12: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
13: * @package Text_Filter
14: */
15: class Horde_Text_Filter_Simplemarkup extends Horde_Text_Filter_Base
16: {
17: /**
18: * Returns a hash with replace patterns.
19: *
20: * @return array Patterns hash.
21: */
22: public function getPatterns()
23: {
24: return array('regexp' => array(
25: // Bold.
26: '/(^|\s| |<br \/>)(\*[^*\s]+\*)(\s| |<br|\.)/i' => '\1<strong>\2</strong>\3',
27:
28: // Underline.
29: '/(^|\s| |<br \/>)(_[^_\s]+_)(\s| |<br|\.)/i' => '\1<u>\2</u>\3',
30:
31: // Italic.
32: ';(^|\s| \;|<br />)(/[^/\s]+/)(\s| \;|<br|\.);i' => '\1<em>\2</em>\3')
33: );
34: }
35:
36: }
37: