PHP Classes

File: vendor/wp-cli/mustangostang-spyc/php4/5to4.php

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Nolimitbuzz WP Theme   vendor/wp-cli/mustangostang-spyc/php4/5to4.php   Download  
File: vendor/wp-cli/mustangostang-spyc/php4/5to4.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Nolimitbuzz WP Theme
WordPress theme to used as start of new themes
Author: By
Last change:
Date: 27 days ago
Size: 728 bytes
 

Contents

Class file image Download
<?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 = preg_replace ('#throw new Exception\\(([^)]*)\\)#i', 'trigger_error($1,E_USER_ERROR)', $code);
 
$code = str_replace ('self::', '$this->', $code);
 
$f = fopen ($dest, 'w');
 
fwrite($f, $code);
 
fclose ($f);
  print
"Written to $dest.\n";
}