Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
248 jpm 1
<?php
2
 
3
class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
4
 
5
    var $colors = array(
6
        'aqua',
7
        'black',
8
        'blue',
9
        'fuchsia',
10
        'gray',
11
        'green',
12
        'lime',
13
        'maroon',
14
        'navy',
15
        'olive',
16
        'purple',
17
        'red',
18
        'silver',
19
        'teal',
20
        'white',
21
        'yellow'
22
    );
23
 
24
 
25
    /**
26
    *
27
    * Renders a token into text matching the requested format.
28
    *
29
    * @access public
30
    *
31
    * @param array $options The "options" portion of the token (second
32
    * element).
33
    *
34
    * @return string The text rendered from the token options.
35
    *
36
    */
37
 
38
    function token($options)
39
    {
40
        $type = $options['type'];
41
        $color = $options['color'];
42
 
43
        if (! in_array($color, $this->colors)) {
44
            $color = '#' . $color;
45
        }
46
 
47
        if ($type == 'start') {
48
            return "<span style=\"color: $color;\">";
49
        }
50
 
51
        if ($options['type'] == 'end') {
52
            return '</span>';
53
        }
54
    }
55
}
56
?>