Example #1
0
        $out .= '//This lib: ' . $this->getPageUrl() . PHP_EOL . PHP_EOL;
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE']) {
            $browserCache = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
            if ($browserCache >= $this->getLastModifiedDate($includes)) {
                header('HTTP/1.1 304 Not Modified');
                exit;
            }
        }
        header('Last-modified: ' . date('r', $this->getLastModifiedDate($includes)));
        $compression = $this->getVar('compression', $config['compression']);
        foreach ($includes as $include) {
            $out .= $this->getScriptFile($include, $compression);
        }
        if (in_array('Depender.Client', $includes) || $this->getVar('client')) {
            $out .= $this->dependerJs($includes);
        }
        print $out;
    }
}
date_default_timezone_set('UTC');
if (!file_exists('cache')) {
    mkdir('cache');
}
$depender = new Depender();
if ($depender->getVar('require') || $depender->getVar('requireLibs') || $depender->getVar('client')) {
    $depender->build();
} else {
    if ($depender->getVar('reset')) {
        $depender->deleteCache('flat');
    }
}
Example #2
0
        foreach ($exclude as $script) {
            $excludes[] = $script;
        }
        $excludes = array_unique($excludes);
        //No duplicate
        $includes = array_diff($includes, $excludes);
        $config = $this->getConfig();
        $out = join($config['copyright'], PHP_EOL) . PHP_EOL . PHP_EOL;
        $out .= '//Contents: ' . join($includes, ', ') . PHP_EOL . PHP_EOL;
        $out .= '//This lib: ' . $this->getPageUrl() . PHP_EOL . PHP_EOL;
        if ($_SERVER['HTTP_IF_MODIFIED_SINCE']) {
            $browserCache = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
            if ($browserCache >= $this->getLastModifiedDate($includes)) {
                header('HTTP/1.1 304 Not Modified');
                exit;
            }
        }
        header('Last-modified: ' . date('r', $this->getLastModifiedDate($includes)));
        foreach ($includes as $include) {
            $out .= $this->getScriptFile($include, $this->getVar('compression'));
        }
        print $out;
    }
}
if (!file_exists('cache')) {
    mkdir('cache');
}
$depender = new Depender();
if ($depender->getVar('require') || $depender->getVar('requireLibs')) {
    $depender->build();
}