removing neoclassic skin
This commit is contained in:
@@ -6,7 +6,7 @@ if (function_exists("http_response_code")) {
|
||||
$http = G::is_https() ? "https" : "http";
|
||||
$host = $_SERVER["SERVER_NAME"] . (($_SERVER["SERVER_PORT"] != "80") ? ":" . $_SERVER["SERVER_PORT"] : "");
|
||||
|
||||
$urlLogin = $http . "://" . $host . "/sys/en/neoclassic/login/login";
|
||||
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
|
||||
$urlHome = $urlLogin;
|
||||
|
||||
if (isset($_GET["url"]) && $_GET["url"] != "") {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$http = G::is_https() ? "https" : "http";
|
||||
$host = $_SERVER["SERVER_NAME"] . (($_SERVER["SERVER_PORT"] != "80")? ":" . $_SERVER["SERVER_PORT"] : "");
|
||||
|
||||
$urlLogin = $http . "://" . $host . "/sys/en/neoclassic/login/login";
|
||||
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
|
||||
$urlHome = $urlLogin;
|
||||
|
||||
if (isset($_GET["url"]) && $_GET["url"] != "") {
|
||||
|
||||
@@ -853,34 +853,34 @@ class Bootstrap
|
||||
}
|
||||
|
||||
/**
|
||||
* streaming a big JS file with small js files
|
||||
* Dynamically generates and streams a CSS file by aggregating smaller CSS files.
|
||||
*
|
||||
* This function is designed to serve CSS content dynamically based on different skins or themes.
|
||||
* It reads configuration files to determine which CSS files to include, handles caching headers,
|
||||
* and performs browser-specific logic to ensure compatibility.
|
||||
*
|
||||
* @author Fernando Ontiveros Lira <fernando@colosa.com>
|
||||
* @access public
|
||||
* @param string $file
|
||||
* @return string
|
||||
* @param string $filename The name of the file, used to determine the skin and variant.
|
||||
* @return string The aggregated and minified CSS content.
|
||||
*/
|
||||
public static function streamCSSBigFile($filename)
|
||||
{
|
||||
// Set the content type to CSS and prevent MIME type sniffing
|
||||
header('Content-Type: text/css');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
|
||||
//First get Skin info
|
||||
// Parse the filename to extract skin name and variant
|
||||
$filenameParts = explode("-", $filename);
|
||||
$skinName = empty($filenameParts[0]) ? 'base' : $filenameParts[0];
|
||||
$skinVariant = "skin";
|
||||
$skinName = !empty($filenameParts[0]) ? $filenameParts[0] : 'base';
|
||||
$skinVariant = isset($filenameParts[1]) ? strtolower($filenameParts[1]) : 'skin';
|
||||
|
||||
if (isset($filenameParts[1])) {
|
||||
$skinVariant = strtolower($filenameParts[1]);
|
||||
// Normalize skin names
|
||||
if (in_array($skinName, ['jscolors', 'xmlcolors'])) {
|
||||
$skinName = 'classic';
|
||||
}
|
||||
|
||||
// Determine the configuration file path based on the skin name
|
||||
$configurationFile = '';
|
||||
if ($skinName == "jscolors") {
|
||||
$skinName = "classic";
|
||||
}
|
||||
if ($skinName == "xmlcolors") {
|
||||
$skinName = "classic";
|
||||
}
|
||||
if ($skinName == "classic") {
|
||||
$configurationFile = Bootstrap::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
|
||||
} else {
|
||||
@@ -894,50 +894,49 @@ class Bootstrap
|
||||
$configurationFile = Bootstrap::ExpandPath("skinEngine") . $skinName . PATH_SEP . 'config.xml';
|
||||
}
|
||||
}
|
||||
// Fallback to base configuration if the specific one doesn't exist
|
||||
if (!file_exists($configurationFile)) {
|
||||
$configurationFile = Bootstrap::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
|
||||
}
|
||||
}
|
||||
|
||||
$mtime = date('U');
|
||||
// Set caching headers
|
||||
$mtime = time();
|
||||
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT";
|
||||
$etag = '"' . Bootstrap::encryptOld($mtime . $filename) . '"';
|
||||
$expires = gmdate("D, d M Y H:i:s", $mtime + 30 * 24 * 60 * 60) . " GMT"; // 1 month
|
||||
|
||||
header('Pragma: cache');
|
||||
header('ETag: "' . Bootstrap::encryptOld($mtime . $filename) . '"');
|
||||
header("Last-Modified: " . $gmt_mtime);
|
||||
header('ETag: ' . $etag);
|
||||
header('Last-Modified: ' . $gmt_mtime);
|
||||
header('Cache-Control: public');
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 30 * 60 * 60 * 24) . " GMT"); //1 month
|
||||
//header("Expires: " . gmdate("D, d M Y H:i:s", time () + 60*60*24 ) . " GMT"); //1 day - tempor
|
||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
||||
if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) {
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
exit();
|
||||
}
|
||||
header('Expires: ' . $expires);
|
||||
|
||||
// Handle conditional requests for caching
|
||||
$ifModifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? null;
|
||||
$ifNoneMatch = $_SERVER['HTTP_IF_NONE_MATCH'] ?? null;
|
||||
|
||||
if (($ifModifiedSince && $ifModifiedSince === $gmt_mtime) ||
|
||||
($ifNoneMatch && str_replace('"', '', stripslashes($ifNoneMatch)) === Bootstrap::encryptOld($mtime . $filename))) {
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
|
||||
if (str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == Bootstrap::encryptOld($mtime . $filename)) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//Read Configuration File
|
||||
// Read and parse the configuration XML file
|
||||
$xmlConfiguration = file_get_contents($configurationFile);
|
||||
$xmlConfigurationObj = Bootstrap::xmlParser($xmlConfiguration);
|
||||
$baseSkinDirectory = dirname($configurationFile);
|
||||
$directorySize = Bootstrap::getDirectorySize($baseSkinDirectory);
|
||||
$mtime = $directorySize['maxmtime'];
|
||||
|
||||
//if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
|
||||
//$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
$outputHeader = "/* Autogenerated CSS file by gulliver framework \n";
|
||||
// Prepare the CSS output with a header comment
|
||||
$outputHeader = "/* Autogenerated CSS file by gulliver framework ** \n";
|
||||
$outputHeader .= " Skin: $filename\n";
|
||||
$mtimeNow = date('U');
|
||||
$gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow) . " GMT";
|
||||
$outputHeader .= " Date: $gmt_mtimeNow*/\n";
|
||||
$output = "";
|
||||
|
||||
//Base files
|
||||
// Include base CSS files based on the skin variant
|
||||
switch (strtolower($skinVariant)) {
|
||||
case "extjs":
|
||||
//Base
|
||||
@@ -952,7 +951,7 @@ class Bootstrap
|
||||
break;
|
||||
}
|
||||
|
||||
//Get Browser Info
|
||||
// Get browser information for compatibility checks
|
||||
$infoBrowser = Bootstrap::get_current_browser();
|
||||
$browserName = $infoBrowser['browser_working'];
|
||||
if (isset($infoBrowser[$browserName . '_data'])) {
|
||||
@@ -961,7 +960,7 @@ class Bootstrap
|
||||
}
|
||||
}
|
||||
|
||||
//Read Configuration File
|
||||
// Parse the configuration to get the list of CSS files to include
|
||||
$xmlConfiguration = file_get_contents($configurationFile);
|
||||
$xmlConfigurationObj = Bootstrap::xmlParser($xmlConfiguration);
|
||||
|
||||
@@ -972,6 +971,8 @@ class Bootstrap
|
||||
if (isset($skinFilesArray['__ATTRIBUTES__'])) {
|
||||
$skinFilesArray = array($skinFilesArray);
|
||||
}
|
||||
|
||||
// Iterate over each CSS file and include it if compatible with the current browser
|
||||
foreach ($skinFilesArray as $keyFile => $cssFileInfo) {
|
||||
$enabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['enabledBrowsers']);
|
||||
$disabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['disabledBrowsers']);
|
||||
@@ -999,8 +1000,14 @@ class Bootstrap
|
||||
}
|
||||
}
|
||||
|
||||
//Remove comments..
|
||||
$regex = array("`^([\t\s]+)`ism" => '', "`^\/\*(.+?)\*\/`ism" => "", "`([\n;]+)\/\*(.+?)\*\/`ism" => "$1", "`([\n;\s]+)//(.+?)[\n\r]`ism" => "$1\n", "`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism" => "\n");
|
||||
// Minify the CSS by removing comments and unnecessary whitespace
|
||||
$regex = array(
|
||||
"`^([\t\s]+)`ism" => '',
|
||||
"`^\/\*(.+?)\*\/`ism" => "",
|
||||
"`([\n;]+)\/\*(.+?)\*\/`ism" => "$1",
|
||||
"`([\n;\s]+)//(.+?)[\n\r]`ism" => "$1\n",
|
||||
"`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism" => "\n"
|
||||
);
|
||||
$output = preg_replace(array_keys($regex), $regex, $output);
|
||||
$output = $outputHeader . $output;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user