Skip to content

Commit

Permalink
Prepare Theme class for Sass
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information
MauricioFauth committed Nov 15, 2018
1 parent dbf4819 commit 59eef96
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Expand Up @@ -7,11 +7,8 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{js,php,twig,phtml,json,css}]
indent_style = space
indent_size = 4

[{*.sql,package.json,.travis.yml}]
indent_style = space
[{*.{sql,scss,css},package.json,.travis.yml}]
indent_size = 2
31 changes: 9 additions & 22 deletions libraries/classes/Theme.php
Expand Up @@ -378,31 +378,18 @@ public function loadCss()
{
$success = true;

/* Variables to be used by the themes: */
$theme = $this;
if ($GLOBALS['text_dir'] === 'ltr') {
$right = 'right';
$left = 'left';
$file = $GLOBALS['text_dir'] === 'rtl' ? '/css/theme-rtl.css' : '/css/theme.css';
$path = $this->getPath() . $file;
$fallback = './themes/' . ThemeManager::FALLBACK_THEME . $file;

if (is_readable($path)) {
include $path;
} elseif (is_readable($fallback)) {
include $fallback;
} else {
$right = 'left';
$left = 'right';
$success = false;
}

foreach ($this->_cssFiles as $file) {
$path = $this->getPath() . "/css/$file.css.php";
$fallback = "./themes/"
. ThemeManager::FALLBACK_THEME . "/css/$file.css.php";

if (is_readable($path)) {
echo "\n/* FILE: " , $file , ".css.php */\n";
include $path;
} elseif (is_readable($fallback)) {
echo "\n/* FILE: " , $file , ".css.php */\n";
include $fallback;
} else {
$success = false;
}
}
return $success;
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/ThemeManager.php
Expand Up @@ -121,7 +121,7 @@ public function __construct()
/**
* Returns the singleton Response object
*
* @return Response object
* @return ThemeManager object
*/
public static function getInstance()
{
Expand Down
1 change: 0 additions & 1 deletion test/classes/ThemeTest.php
Expand Up @@ -148,7 +148,6 @@ public function testLoadCss($theme)
$out = ob_get_contents();
ob_end_clean();
$this->assertTrue($ret);
$this->assertContains('FILE: navigation.css.php', $out);
$this->assertContains('.ic_b_bookmark', $out);
}

Expand Down

0 comments on commit 59eef96

Please sign in to comment.