Ejemplo n.º 1
0
 */
set_time_limit(600);
$root = dirname(dirname(__FILE__)) . '/library';
set_include_path($root . PATH_SEPARATOR . get_include_path());
require_once 'Jazz/Util.php';
ini_set('phar.readonly', 0);
if (Phar::canWrite() === true) {
    $phar = new Phar(dirname(__FILE__) . '/Jazz.phar', 0);
    $phar->startBuffering();
    $phar->setStub($phar->createDefaultStub('stub.php'));
    $phar->addFromString('stub.php', '<?php ');
    $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS));
    foreach ($dir as $file) {
        /* @var DirectoryIterator $file */
        $name = $file->getFilename();
        $contents = formatFileContents($file->getPathname());
        $path = str_replace(array($root, '\\'), array('', '/'), $file->getPathname());
        $phar->addFromString($path, $contents);
        \Jazz\Util::test('added ' . $path);
    }
    $phar->stopBuffering();
    die('complete');
}
die('unable to write PHAR, verify "phar.readonly" is off');
/** HELPER FUNCTIONS **/
/**
 * Formats the file contents, removing comments and empty lines
 * @param string $path File path
 * @return string
 */
function formatFileContents($path)
Ejemplo n.º 2
0
/**
 * printFileContentsHTML()
 *
 * Grab the files's contents and format it with HTML
 * all in one step.
 */
function printFileContentsHTML($file = LACE_FILE)
{
    return formatFileContents(getFileContentsRaw($file));
}