scratch – Blame information for rev 66
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
66 | office | 1 | <?php |
2 | |||
3 | php5to4 ("../spyc.php", 'spyc-latest.php4'); |
||
4 | |||
5 | function php5to4 ($src, $dest) { |
||
6 | $code = file_get_contents ($src); |
||
7 | $code = preg_replace ('#(public|private|protected)\s+\$#i', 'var \$', $code); |
||
8 | $code = preg_replace ('#(public|private|protected)\s+static\s+\$#i', 'var \$', $code); |
||
9 | $code = preg_replace ('#(public|private|protected)\s+function#i', 'function', $code); |
||
10 | $code = preg_replace ('#(public|private|protected)\s+static\s+function#i', 'function', $code); |
||
11 | $code = preg_replace ('#throw new Exception\\(([^)]*)\\)#i', 'trigger_error($1,E_USER_ERROR)', $code); |
||
12 | $code = str_replace ('self::', '$this->', $code); |
||
13 | $f = fopen ($dest, 'w'); |
||
14 | fwrite($f, $code); |
||
15 | fclose ($f); |
||
16 | print "Written to $dest.\n"; |
||
17 | } |