// search for all images in gallery module CSS and serve them through the yui_image.php script $filecontent = preg_replace('/([a-z0-9_-]+)\\.(png|gif)/', 'yui_image.php?file=' . $version . '/' . $bits[0] . '/' . $bits[1] . '/$1.$2', $filecontent); } else { // First we need to remove relative paths to images. These are used by YUI modules to make use of global assets. // I've added this as a separate regex so it can be easily removed once // YUI standardise there CSS methods $filecontent = preg_replace('#(\\.\\./\\.\\./\\.\\./\\.\\./assets/skins/sam/)?([a-z0-9_-]+)\\.(png|gif)#', '$2.$3', $filecontent); // search for all images in yui2 CSS and serve them through the yui_image.php script $filecontent = preg_replace('/([a-z0-9_-]+)\\.(png|gif)/', 'yui_image.php?file=' . $version . '/$1.$2', $filecontent); } } } $content .= $filecontent; } if ($cache) { combo_send_cached($content, $mimetype); } else { combo_send_uncached($content, $mimetype); } /** * Send the JavaScript cached * @param string $content * @param string $mimetype */ function combo_send_cached($content, $mimetype) { $lifetime = 60 * 60 * 24 * 300; // 300 days === forever header('Content-Disposition: inline; filename="combo"'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
$filecontent = preg_replace('#(\.\./\.\./\.\./\.\./assets/skins/sam/)?([a-z0-9_-]+)\.(png|gif)#', '$2.$3', $filecontent); // search for all images in yui2 CSS and serve them through the yui_image.php script $filecontent = preg_replace('/([a-z0-9_-]+)\.(png|gif)/', $relroot.'/theme/yui_image.php'.$sep.$version.'/$1.$2', $filecontent); } } $content .= $filecontent; } if ($lastmodified == 0) { $lastmodified = time(); } if ($cache) { combo_send_cached($content, $mimetype, $etag, $lastmodified); } else { combo_send_uncached($content, $mimetype); } /** * Send the JavaScript cached * @param string $content * @param string $mimetype * @param string $etag * @param int $lastmodified */ function combo_send_cached($content, $mimetype, $etag, $lastmodified) { $lifetime = 60*60*24*360; // 1 year, we do not change YUI versions often, there are a few custom yui modules