4 This filter plugin converts pages content into all-uppercase, if someone
5 edits a page and leaves at least one line of uppercase characters (a
6 persistent cookie is set).
10 define("EWIKI_UP_SCREAMOMATIC", "screamomatic");
12 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_fun_screamomatic";
13 $ewiki_plugins["page_final"][] = "ewiki_page_final_fun_screamomatic";
16 function ewiki_edit_save_fun_screamomatic(&$save, &$old) {
18 #-- count lines of yelling
19 preg_match_all("/^[^a-z\340-\377_\n]{10,}$/m", $old["content"], $uu);
20 $old_screaming = count($uu[0]);
21 preg_match_all("/^[^a-z\340-\377_\n]{10,}$/m", $save["content"], $uu);
22 $new_screaming = count($uu[0]);
25 if ($new_screaming > $old_screaming) {
26 setcookie(EWIKI_UP_SCREAMOMATIC, "true", time()+7*24*3600, "/");
31 function ewiki_page_final_fun_screamomatic(&$html, $id, &$data, $action) {
32 if ($_COOKIE[EWIKI_UP_SCREAMOMATIC]) {
33 $html = preg_replace('/>([^<>]+)</e',
34 '">".strtoupper(stripslashes("\\1"))."<"', $html);