|
Revision 1, 1.1 KB
(checked in by anonymous, 7 years ago)
|
|
initial import
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | if (!function_exists("make_tr")) |
|---|
| 4 | { |
|---|
| 5 | function make_tr($text) |
|---|
| 6 | { |
|---|
| 7 | global $_site; |
|---|
| 8 | $rval = ""; |
|---|
| 9 | $lines = split("\|\|", $text); |
|---|
| 10 | $first=true; |
|---|
| 11 | foreach ($lines as $line) |
|---|
| 12 | { |
|---|
| 13 | if($line!="\n" && $line!="") |
|---|
| 14 | { |
|---|
| 15 | if($first) |
|---|
| 16 | $type='th'; |
|---|
| 17 | else |
|---|
| 18 | $type='td'; |
|---|
| 19 | $rval.= "\t<tr>\n".make_cel($line, $type)."\t</tr>\n"; |
|---|
| 20 | $first=false; |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | } |
|---|
| 24 | return $rval; |
|---|
| 25 | } |
|---|
| 26 | } |
|---|
| 27 | if (!function_exists("make_cel")) |
|---|
| 28 | { |
|---|
| 29 | function make_cel($text, $type='td') |
|---|
| 30 | { |
|---|
| 31 | global $_site; |
|---|
| 32 | |
|---|
| 33 | $rval = ""; |
|---|
| 34 | $cels = split("\|", $text); |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | foreach ($cels as $cel) |
|---|
| 38 | { |
|---|
| 39 | if($cel!="\n" && $cel!="") |
|---|
| 40 | { |
|---|
| 41 | $align=0; |
|---|
| 42 | |
|---|
| 43 | if(ereg("^\s+", $cel)) |
|---|
| 44 | $align=10; |
|---|
| 45 | if(ereg("\s+$", $cel)) |
|---|
| 46 | $align++; |
|---|
| 47 | |
|---|
| 48 | switch ($align) |
|---|
| 49 | { |
|---|
| 50 | case 10: |
|---|
| 51 | $align_str="align='right'"; |
|---|
| 52 | break; |
|---|
| 53 | case 11: |
|---|
| 54 | $align_str="align='center'"; |
|---|
| 55 | break; |
|---|
| 56 | default: |
|---|
| 57 | $align_str=""; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | $rval.= "\t\t<$type $align_str>".Wikise($cel, "wakka")."</$type>\n"; |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | return $rval; |
|---|
| 64 | } |
|---|
| 65 | } |
|---|
| 66 | print "\n<table class='wiki'>\n".make_tr($text)."</table>\n"; |
|---|
| 67 | |
|---|
| 68 | ?> |
|---|