mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
1b85594524
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@93526 467b73ca-7a2a-4603-9d3b-597d59a354a9
16 lines
623 B
PHP
16 lines
623 B
PHP
<?php
|
|
|
|
php5to4 ("../spyc.php", 'spyc-latest.php4');
|
|
|
|
function php5to4 ($src, $dest) {
|
|
$code = file_get_contents ($src);
|
|
$code = preg_replace ('#(public|private|protected)\s+\$#i', 'var \$', $code);
|
|
$code = preg_replace ('#(public|private|protected)\s+static\s+\$#i', 'var \$', $code);
|
|
$code = preg_replace ('#(public|private|protected)\s+function#i', 'function', $code);
|
|
$code = preg_replace ('#(public|private|protected)\s+static\s+function#i', 'function', $code);
|
|
$code = str_replace ('self::', '$this->', $code);
|
|
$f = fopen ($dest, 'w');
|
|
fwrite($f, $code);
|
|
fclose ($f);
|
|
print "Written to $dest.\n";
|
|
} |