From: Alexander Ebert Date: Mon, 31 Oct 2016 13:50:33 +0000 (+0100) Subject: Fixed style compiler X-Git-Tag: 3.0.0_Beta_5~77^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=99ee3c6a2555d1c5ab38b3c72eaebe7e0f69c0ba;p=GitHub%2FWoltLab%2FWCF.git Fixed style compiler --- diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 319b1ffd0e..c59d32bce4 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -49,51 +49,19 @@ class StyleCompiler extends SingletonFactory { * @param Style $style */ public function compile(Style $style) { - // read stylesheets by dependency order - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("filename REGEXP ?", ['style/([a-zA-Z0-9\_\-\.]+)\.scss']); - - // TESTING ONLY - $conditions->add("packageID <> ?", [1]); - // TESTING ONLY + $files = $this->getCoreFiles(); + // read stylesheets in dependency order $sql = "SELECT filename, application FROM wcf".WCF_N."_package_installation_file_log - ".$conditions." + WHERE filename REGEXP ? + AND packageID <> ? ORDER BY packageID"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditions->getParameters()); - - $files = []; - - // TESTING ONLY - if ($handle = opendir(WCF_DIR.'style/')) { - while (($file = readdir($handle)) !== false) { - if ($file === '.' || $file === '..' || $file === 'bootstrap' || is_file(WCF_DIR.'style/'.$file)) { - continue; - } - - $file = WCF_DIR."style/{$file}/"; - if ($innerHandle = opendir($file)) { - while (($innerFile = readdir($innerHandle)) !== false) { - if ($innerFile === '.' || $innerFile === '..' || !is_file($file.$innerFile) || !preg_match('~^[a-zA-Z0-9]+\.scss$~', $innerFile)) { - continue; - } - - $files[] = $file.$innerFile; - } - closedir($innerHandle); - } - } - - closedir($handle); - - // directory order is not deterministic in some cases - sort($files); - } - - // TESTING ONLY - + $statement->execute([ + 'style/([a-zA-Z0-9\-\.]+)\.scss', + 1 + ]); while ($row = $statement->fetchArray()) { $files[] = Application::getDirectory($row['application']).$row['filename']; } @@ -140,56 +108,10 @@ class StyleCompiler extends SingletonFactory { * Compiles SCSS stylesheets for ACP usage. */ public function compileACP() { - // read stylesheets by dependency order - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("filename REGEXP ?", ['style/([a-zA-Z0-9\_\-\.]+)\.scss']); - - // TESTING ONLY - $conditions->add("packageID <> ?", [1]); - // TESTING ONLY - - $sql = "SELECT filename, application - FROM wcf".WCF_N."_package_installation_file_log - ".$conditions." - ORDER BY packageID"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditions->getParameters()); - - $files = []; - - // TESTING ONLY - if ($handle = opendir(WCF_DIR.'style/')) { - while (($file = readdir($handle)) !== false) { - if ($file === '.' || $file === '..' || $file === 'bootstrap' || is_file(WCF_DIR.'style/'.$file)) { - continue; - } - - $file = WCF_DIR."style/{$file}/"; - if ($innerHandle = opendir($file)) { - while (($innerFile = readdir($innerHandle)) !== false) { - if ($innerFile === '.' || $innerFile === '..' || !is_file($file.$innerFile) || !preg_match('~^[a-zA-Z]+\.scss$~', $innerFile)) { - continue; - } - - $files[] = $file.$innerFile; - } - closedir($innerHandle); - } - } - - closedir($handle); - - // directory order is not deterministic in some cases - sort($files); - } - - $additional = ['layout']; - for ($i = 0, $length = count($additional); $i < $length; $i++) { - $files[] = WCF_DIR . 'acp/style/' . $additional[$i] . '.scss'; - } - // TESTING ONLY + $files = $this->getCoreFiles(); - //$files = glob(WCF_DIR.'style/*.less'); + // ACP uses a slightly different layout + $files[] = WCF_DIR . 'acp/style/layout.scss'; // read default values $sql = "SELECT variableName, defaultValue @@ -212,10 +134,7 @@ class StyleCompiler extends SingletonFactory { $variables['wcfFontFamily'] = '"' . $variables['wcfFontFamilyGoogle'] . '", ' . $variables['wcfFontFamily']; } - // insert blue temptation files - //array_unshift($files, WCF_DIR.'acp/style/blueTemptation/variables.scss', WCF_DIR.'acp/style/blueTemptation/override.scss'); - - $variables['style_image_path'] = "'../images/blueTemptation/'"; + $variables['style_image_path'] = "'../images/'"; $this->compileStylesheet( WCF_DIR.'acp/style/style', @@ -226,13 +145,48 @@ class StyleCompiler extends SingletonFactory { // fix relative paths $content = str_replace('../font/', '../../font/', $content); $content = str_replace('../icon/', '../../icon/', $content); - $content = preg_replace('~\.\./images/(?!blueTemptation)~', '../../images/', $content); + $content = preg_replace('~\.\./images/~', '../../images/', $content); return "/* stylesheet for ACP, generated on ".gmdate('r')." -- DO NOT EDIT */\n\n" . $content; }) ); } + /** + * Returns a list of common stylesheets provided by the core. + * + * @return string[] list of common stylesheets + */ + protected function getCoreFiles() { + $files = []; + if ($handle = opendir(WCF_DIR.'style/')) { + while (($file = readdir($handle)) !== false) { + if ($file === '.' || $file === '..' || $file === 'bootstrap' || is_file(WCF_DIR.'style/'.$file)) { + continue; + } + + $file = WCF_DIR."style/{$file}/"; + if ($innerHandle = opendir($file)) { + while (($innerFile = readdir($innerHandle)) !== false) { + if ($innerFile === '.' || $innerFile === '..' || !is_file($file.$innerFile) || !preg_match('~^[a-zA-Z0-9\-\.]+\.scss$~', $innerFile)) { + continue; + } + + $files[] = $file.$innerFile; + } + closedir($innerHandle); + } + } + + closedir($handle); + + // directory order is not deterministic in some cases + sort($files); + } + + return $files; + } + /** * Prepares the style compiler by adding variables to environment. * diff --git a/wcfsetup/install/files/style/ui/imageViewer.scss b/wcfsetup/install/files/style/ui/imageViewer.scss index 7229f742c0..aafd1f5c9e 100644 --- a/wcfsetup/install/files/style/ui/imageViewer.scss +++ b/wcfsetup/install/files/style/ui/imageViewer.scss @@ -217,24 +217,6 @@ $wcfImageViewerFontColor: rgba(211, 211, 211, 1); z-index: 401; &.loading:before { - /*content: $fa-var-spinner; - margin: -24px 0 0 -24px; - left: 50%; - position: absolute; - top: 50%; - - color: #fff; - display: inline-block; - font-family: FontAwesome; - font-weight: normal !important; - font-style: normal !important; - line-height: 1em; - text-align: center; - - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none;*/ - @extend .icon48; @extend .fa-spinner; }