PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/spyc/lib/php4/5to4.php

http://zoop.googlecode.com/
PHP | 16 lines | 14 code | 2 blank | 0 comment | 0 complexity | 256cc860663517e5385f9a5e9507af18 MD5 | raw file
 1<?php
 2
 3php5to4 ("../spyc.php", 'spyc-latest.php4');
 4
 5function 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 = str_replace ('self::', '$this->', $code);
12  $f = fopen ($dest, 'w');
13  fwrite($f, $code);
14  fclose ($f);
15  print "Written to $dest.\n";
16}