php header Content-type text plain text TEXT button onclick width 100

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
header('Content-type: text/plain');
$text = <<<TEXT
<button onclick="a b c width=100>
<button onclick='a b c width=100>
<button onclick=a b c' width=100>
<button onclick=a b c" width=100>
<button onclick=a b c width=100>
<button onclick="a('c') width=100>
<button onclick="a b c width=100>
<button onclick='a b c width=100>
<button onclick=a b c' width=100>
<button onclick=a b c" width=100>
<button onclick=a b c width=100>
<image onclick="a('c') width=100>
<image onstart= "core.ajax()"width=100>
<image onstart = "core.ajax()" width=100>
TEXT;
function del_js($text){
//причешим код)
$preg = preg_match_all("#<\w+ ([^>]+)>#si", $text, $m);
foreach($m[0] as $tag){
$n_tag = preg_replace("# (on\w+[^=]+)=(\"|'| )#si", " $1=", $tag);
$n_tag = str_replace(array(" =", " = ", "= "), "=", $n_tag);
$text = str_replace($tag, $n_tag, $text);
}
$text = preg_replace("# on\w+=[^=]+ (\S+=)#si"," $1",$text);
$text = preg_replace("# on\w+=(\"|'|)[^\"'> ]+(\" | |' |>|\"|')#si"," ",$text);
return $text;
}
$text = del_js($text);
echo $text;
?>