示例#1
0
     $parts = explode("/", $yuiFile);
     if (isset($parts[0]) && isset($parts[1]) && isset($parts[2])) {
         //Add module to array for loading
         $yuiComponents[] = $parts[2];
     } else {
         throw new Exception('Unable to determine module name!');
     }
 }
 //Load the components
 call_user_func_array(array($loader, 'load'), $yuiComponents);
 //Set cache headers and output raw file content
 header("Cache-Control: max-age=315360000");
 header("Expires: " . date("D, j M Y H:i:s", strtotime("now + 10 years")) . " GMT");
 header("Content-Type: " . $contentType);
 if ($contentType == "application/x-javascript") {
     $rawScript = $loader->script_raw();
     if (APC_AVAIL === true) {
         apc_store(server(true), $rawScript, APC_TTL);
     }
     echo $rawScript;
 } else {
     $rawCss = '';
     $cssResourceList = $loader->css_data();
     foreach ($cssResourceList["css"] as $cssResource => $val) {
         foreach ($cssResourceList["css"][$cssResource] as $key => $value) {
             $crtResourceBase = substr($key, 0, strrpos($key, "/") + 1);
             $crtResourceContent = $loader->getRemoteContent($key);
             //Handle image path corrections (order is important)
             $crtResourceContent = preg_replace('/((url\\()([^\\.\\.|^http]\\S+)(\\)))/', '${2}' . $crtResourceBase . '${3}${4}', $crtResourceContent);
             // just filename or subdirs/filename (e.g) url(foo.png),
             // url(foo/foo.png)
示例#2
0
    }
    include "./loader.php";
    $loader = new YAHOO_util_Loader($yuiVersion);
    $base = PATH_TO_LOADER . $loader->comboDefaultVersion . "/build/";
    //Defaults to current version
    //Detect and load the required components now
    $baseOverrides = array();
    $yuiComponents = array();
    foreach ($yuiFiles as $yuiFile) {
        $parts = explode("/", $yuiFile);
        if (isset($parts[0]) && isset($parts[1]) && isset($parts[2])) {
            //Add module to array for loading
            $yuiComponents[] = $parts[2];
        } else {
            die('<!-- Unable to determine module name! -->');
        }
    }
    //Load the components
    call_user_func_array(array($loader, 'load'), $yuiComponents);
    //Set cache headers and output raw file content
    header("Cache-Control: max-age=315360000");
    header("Expires: " . date("D, j M Y H:i:s", strtotime("now + 10 years")) . " GMT");
    header("Content-Type: " . $contentType);
    if ($contentType == "application/x-javascript") {
        echo $loader->script_raw();
    } else {
        echo $loader->css_raw();
    }
} else {
    die('<!-- No YUI modules defined! -->');
}