4 Ripped from the debian text filters package. This filter was originally
5 written by Joey Hess. While this wasn't mentioned clearly I would assume
6 that these two lines were released under the GNU GPL (so now is this
7 file, see the GPL.txt file).
8 (this is mostly reverse-engineered, the perl stuff made no sense to me
10 This implementation uses "J" to replace "r", to make it distinguishable
11 from the transited "f".
12 Good fonts to use with this plugin are sans-serif ones like Arial
18 $ewiki_plugins["view_final"][] = "ewiki_page_upsidedown";
19 //$ewiki_plugins["handler"][] = "ewiki_page_view_preconvert_upsidedown";
22 #-- reverses all lines of text
23 function ewiki_page_view_preconvert_upsidedown(&$id, &$data, &$action) {
24 if ($action == "view") {
25 $data["content"] = implode("\n", array_reverse(explode("\n", $data["content"])));
30 #-- sends all text pieces trough the filter function below
31 function ewiki_page_upsidedown(&$o) {
32 $o = preg_replace('/>([^<>]+)</e',
33 '">".htmlentities((str_upsidedown(stripslashes("\\1"))))."<"', $o);
37 #-- this does the string transformation for plain ASCII text
38 function str_upsidedown($text) {
40 $text = explode("\n", $text);
41 foreach ($text as $i=>$line) {
43 $line = strrev($line);
44 $line = str_replace('"', "''", $line);
45 $line = strtolower($line);
48 "abcdefghijklmnopqrstuvwxyz 123456789 ,!?¯_ []{}<> .'' ",
49 "eq)paj6y!fk7wuodbJsfn^mxhz l2Eh59L86 `i¿_¯ ][}{>< ',, "
52 $line = str_replace("k", ">|", $line);
56 $text = implode("\n", $text);
63 function decode_upsidedown($text) {
64 $text = explode("\n", $text);
65 foreach ($text as $i=>$line) {
66 $line = str_replace(">|", "k", $line);
68 "eq)paj6y!fk7wuodbJsfn^mxhz l2E59L8 `i%_¯ ][}{>< ',, ",
69 "abcdefghijklmnopqrstuvwxyz 1235678 ,!?¯_ []{}<> .'' "
71 $line = str_replace("''", '"', $line);
72 $line = strrev($line);
75 $text = implode("\n", $text);