Beispiel #1
0
/**
* List all files in a directory, recursively.
*
* @param $path
*	...
*
* @param $filetypes
*	...
*
* @return
*	...
*/
function rglob_files($path = '', $filetypes = array())
{
    // Accept file type restrictions as a single array or multiple independent values
    $arguments = func_get_args();
    array_shift($arguments);
    $filetypes = array_flatten($arguments);
    // Run glob_files for this directory and its subdirectories
    $files = glob_files($path, $filetypes);
    foreach (glob_dir($path) as $child) {
        $files = array_merge($files, rglob_files($child, $filetypes));
    }
    return $files;
}
Beispiel #2
0
$title = 'Layers CSS';
$save = false;
if (in_array($_SERVER['SERVER_ADDR'], array('127.0.0.1', '::1')) and !isset($_GET['dontsave'])) {
    $save = true;
}
// Find title with version info (first line in readme)
$readme = trim(file_get_contents($readmePath));
$readme = str_replace('# ', '', substr($readme, 0, strpos($readme, "\n")));
if (strpos($readme, $title) !== false) {
    $title = $readme;
}
// Release each script
foreach ($releases as $name) {
    // Read source files
    $source = '';
    foreach (rglob_files($sourcePath . $name . '/') as $value) {
        $source .= file_get_contents($value);
    }
    // Author info
    $prefix = '/*
' . $title . ' ' . ($name === 'responsive' ? ' responsive adjustments' : '') . '
Released by Jerry Jäppinen under the MIT license
http://eiskis.net/layers
' . date('Y-m-d') . '
*/
';
    $minRelease = $prefix . minify($source);
    $release = $prefix . $source;
    // Save compilation file on localhost
    if ($save) {
        file_put_contents($releasePath . $name . '.css', $release);