示例#1
0
}

// Serve
if (isset($_GET['f'])) {
    $_GET['f'] = str_replace("\x00", '', (string)$_GET['f']);
    $filenames = explode(",", $_GET['f']);
    $filenamePattern = '/[^\'"\\/\\\\]+\\.(?:' . implode('|', $serveExtensions) . ')$/';

    if ($minifyCachePath) {
        SpeedsterMinify::setCache($minifyCachePath);
    }

    if ($min_documentRoot) {
        $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
    } elseif (0 === stripos(PHP_OS, 'win')) {
        SpeedsterMinify::setDocRoot(); // IIS may need help
    }

    //on some apache installs this is needed
    if (array_key_exists('SUBDOMAIN_DOCUMENT_ROOT', $_SERVER)) {
        $_SERVER['DOCUMENT_ROOT'] = $_SERVER['SUBDOMAIN_DOCUMENT_ROOT'];
    }

    //check if requested files exists and add to minify request
    $servefiles = array();
    foreach ($filenames as $filename) {
        if (preg_match($filenamePattern, $filename)
            && file_exists(BP . $filename)
        ) {
            $servefiles[] = BP . $filename;
        }
示例#2
0
    $min_symlinks = array('//' => $rootdir);
    //use this for ~user apache installs
    //$min_symlinks=array( '/'.$dir[0]=>$rootdir);
}
// Serve
if (isset($_GET['f'])) {
    $_GET['f'] = str_replace("", '', (string) $_GET['f']);
    $filenames = explode(",", $_GET['f']);
    $filenamePattern = '/[^\'"\\/\\\\]+\\.(?:' . implode('|', $serveExtensions) . ')$/';
    if ($minifyCachePath) {
        SpeedsterMinify::setCache($minifyCachePath);
    }
    if ($min_documentRoot) {
        $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
    } elseif (0 === stripos(PHP_OS, 'win')) {
        SpeedsterMinify::setDocRoot();
        // IIS may need help
    }
    //on some apache installs this is needed
    if (array_key_exists('SUBDOMAIN_DOCUMENT_ROOT', $_SERVER)) {
        $_SERVER['DOCUMENT_ROOT'] = $_SERVER['SUBDOMAIN_DOCUMENT_ROOT'];
    }
    //check if requested files exists and add to minify request
    $servefiles = array();
    foreach ($filenames as $filename) {
        if (preg_match($filenamePattern, $filename) && file_exists($baseDir . $filename)) {
            $servefiles[] = $baseDir . $filename;
        }
    }
    //options for minify request
    $serveOptions = array('quiet' => false, 'rewriteCssUris' => true, 'files' => $servefiles, 'maxAge' => 31536000, 'bubbleCssImports' => 'true');