6ebffb603fbbda1ab3a39a02c775e554d4c5c5d1
[atutor.git] / mods / wiki / plugins / filter / fun_wella.php
1 <?php
2
3 /*
4    adds some CSS to "beautify" the wiki page output,
5    many things can be configured inside of the code generation function;
6    the idea for this were brought from http://meyerweb.com/ and the original
7    'wella' text filter script
8 */
9
10
11 $ewiki_plugins["view_final"][] = "ewiki_view_final_fun_wella";
12
13
14 function ewiki_view_final_fun_wella(&$html, $id, $data, $action) {
15
16    #-- configuration
17    $where = "both";             // both, left, right, none
18    $width = 60;                 // actually only the half of the used width
19    $start = 0.25 * M_PI;        // where sin() starts
20    $length = 3 * M_PI;          // how much indentation to produce
21    $dx = M_PI / 32;             // calculation step width
22
23    $o = "";
24    for ($x=$start; $x<$length; $x+=$dx) {
25
26       $n = (int) ($width + $width * sin($x));
27
28       switch($where) {
29
30          case "both":
31            $o .= '<span style="float:left;clear:left;width:'.$n.'px;">&nbsp;</span>'.
32                  '<span style="float:right;clear:right;width:'.(2*$width-$n).'px;">&nbsp;</span>';
33            break;
34
35          default:
36            $o .= '<span style="float:' . $where . ';clear:' . $where .
37                  ';width:' . $n . 'px;">&nbsp;</span>';
38            break;
39       }
40    }
41
42    $o .= '<br style="display:none;">';
43    $html = "$o$html";
44 }
45
46
47 ?>