forked from gabordemooij/redbean
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplica.php
More file actions
executable file
·29 lines (23 loc) · 794 Bytes
/
replica.php
File metadata and controls
executable file
·29 lines (23 loc) · 794 Bytes
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
<?php
$pat = "/\/\*([\n]|.)+?\*\//";
function clean($raw) {
global $pat;
$raw = str_replace("\r\n","\n",$raw); //str_replace("\r\n","\n", '<?php ' . "\n/** " . file_get_contents($base . 'license.txt') . "**/\n" . self::$class_definitions);
$raw = str_replace("\n\r","\n",$raw);
$raw = preg_replace("/\n+/", "\n", $raw);
$raw = str_replace("<?php", "", $raw);
$raw = str_replace("?>", "", $raw);
//$raw = preg_replace($pat, "", $raw);
$raw = preg_replace("/\/\/.*/", "", $raw);
return $raw;
}
$code = "<?php ";
$loader = simplexml_load_file("replica.xml");
$items = $loader->load->item;
foreach($items as $item) {
echo "Adding: $item \n";
$raw = file_get_contents( $item );
$code.=clean($raw);
}
//echo $code;
file_put_contents("rb.php", $code);