Back to index

php5  5.3.10
build_precommand.php
Go to the documentation of this file.
00001 #!/usr/bin/php
00002 <?php echo '<'.'?php';?>
00003 
00012 foreach(array("SPL", "Reflection", "Phar") as $ext) {
00013        if (!extension_loaded($ext)) {
00014               echo "$argv[0] requires PHP extension $ext.\n";
00015               exit(1);
00016        }
00017 }
00018 
00019 <?php
00020 
00021 $classes = array(
00022        'DirectoryTreeIterator',
00023        'DirectoryGraphIterator',
00024        'InvertedRegexIterator',
00025        'CLICommand',
00026        'PharCommand',
00027        );
00028 
00029 foreach($classes as $name) {
00030        echo "if (!class_exists('$name', 0))\n{\n";
00031        $f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
00032        unset($f[0]);
00033        $c = count($f);
00034        while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
00035               unset($f[$c--]);
00036        }
00037        if (substr($f[$c], -2) == "\r\n") {
00038               $f[$c] = substr($f[$c], 0, -2);
00039        }
00040        if (substr($f[$c], -1) == "\n") {
00041               $f[$c] = substr($f[$c], 0, -1);
00042        }
00043        if (substr($f[$c], -2) == '?>') {
00044               $f[$c] = substr($f[$c], 0,-2);
00045        }
00046        while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
00047               unset($f[$c--]);
00048        }
00049        echo join('', $f);
00050        echo "\n}\n\n";
00051 }
00052 
00053 echo 'new PharCommand($argc, $argv);'."\n";
00054 
00055 ?>