From 59047796d1d959fdc603e13611d1ee97dad939bc Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 17 Jun 2013 15:40:39 -0700 Subject: [PATCH] Added THEME_STYLE constant for easy checking of the currently selected theme style. CSSORDER also added, but subject to change. --- class2.php | 9 +++++++++ e107_core/templates/header_default.php | 25 +++++++++++++++++++++++-- e107_handlers/db_debug_class.php | 2 +- e107_handlers/theme_handler.php | 4 ++-- e107_themes/bootstrap/theme.php | 16 ++++++++++++++-- 5 files changed, 49 insertions(+), 7 deletions(-) diff --git a/class2.php b/class2.php index 683a7e8d3..507116938 100644 --- a/class2.php +++ b/class2.php @@ -1092,6 +1092,15 @@ if(!defined("THEME_LAYOUT")) } */ + if(varset($pref['themecss']) && file_exists(THEME.$pref['themecss'])) + { + define("THEME_STYLE", $pref['themecss']); + } + else + { + define("THEME_STYLE", 'style.css'); + } + if($def) // custom-page layout. { define("THEME_LAYOUT",$def); diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index a86dd91fc..313c98471 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -251,6 +251,10 @@ else else { // Theme default + + $e_js->themeCSS(THEME_STYLE, $css_default); + + /* Moved to class2 and defined as THEME_STYLE if($e_pref->get('themecss') && file_exists(THEME.$e_pref->get('themecss'))) { //echo "\n"; @@ -258,10 +262,10 @@ else } else { - echo "\n"; + // echo "\n"; $e_js->themeCSS('style.css', $css_default); } - + */ // Support for print and handheld media - override theme default CSS if(file_exists(THEME."style_mobile.css")) { @@ -297,6 +301,20 @@ else // // Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility; NOTE - could be removed in the future!!! + +//TODO Additional options for 'bootstrap' and 'style' (ie. THEME_STYLE loaded above). Requires changes to js_manager.php + +$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme','inline'); + +foreach($CSSORDER as $val) +{ + $cssId = $val."_css"; + $e_js->renderJs($cssId, false, 'css', false); +} + +unset($CSSORDER); + +/* $e_js->renderJs('other_css', false, 'css', false); echo "\n\n"; @@ -313,9 +331,12 @@ echo "\n\n"; $e_js->renderJs('theme_css', false, 'css', false); echo "\n\n"; + // Inline CSS - not sure if this should stay at all! $e_js->renderJs('inline_css', false, 'css', false); echo "\n\n"; +*/ + // // Style for unobtrusive JS, prevent 3rd party code overload diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php index 8446d4de0..c61fcdebe 100644 --- a/e107_handlers/db_debug_class.php +++ b/e107_handlers/db_debug_class.php @@ -519,7 +519,7 @@ class e107_db_debug { $inc = array( 'HEADERF','FOOTERF','FILE_UPLOADS','FLOODPROTECT','FLOODTIMEOUT','CHARSET', 'GUESTS_ONLINE','MEMBERS_ONLINE','PAGE_NAME','STANDARDS_MODE','TIMEOFFSET', - 'TOTAL_ONLINE','THEME','THEME_ABS','THEME_LAYOUT','META_OG','META_DESCRIPTION','MPREFIX' + 'TOTAL_ONLINE','THEME','THEME_ABS','THEME_LAYOUT','THEME_STYLE','META_OG','META_DESCRIPTION','MPREFIX','VIEWPORT','BODYTAG','CSSORDER' ); $userCon = get_defined_constants(true); diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 5538608f0..0537e90e2 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -222,7 +222,7 @@ class themeHandler $reject = array('e_.*'); - $handle2 = e107::getFile()->get_files(e_THEME.$file."/", ".php|.css|.xml|preview.jpg|preview.png", $reject, 1); + $handle2 = e107::getFile()->get_files(e_THEME.$file."/", ".php|.css|.xml|preview.jpg|preview.png", $reject, 0); foreach ($handle2 as $fln) @@ -1337,7 +1337,7 @@ class themeHandler if($mode == 1) // SITE-THEME Mode { - if(substr($css['name'], 0, 6) == "admin_" || !strstr($css['name'],'style')) + if(substr($css['name'], 0, 6) == "admin_") { continue; } diff --git a/e107_themes/bootstrap/theme.php b/e107_themes/bootstrap/theme.php index 9a03c8062..0be5879d1 100644 --- a/e107_themes/bootstrap/theme.php +++ b/e107_themes/bootstrap/theme.php @@ -9,12 +9,23 @@ define("BODYTAG", ''); e107::lan('theme'); e107::js('core','bootstrap/js/bootstrap.min.js'); -e107::css('core','bootstrap/css/bootstrap.min.css'); + +if(THEME_STYLE != 'style.css') // allow for drop-in bootstrap replacement. See http://bootswatch.com +{ + define("CSSORDER", "theme,core,other,plugin,inline"); +} +else +{ + e107::css('core','bootstrap/css/bootstrap.min.css'); +} + e107::css('core','bootstrap/css/bootstrap-responsive.min.css'); e107::css('core','bootstrap/css/jquery-ui.custom.css'); e107::css('theme', 'js/google-code-prettify/prettify.css'); - e107::js('theme', "js/google-code-prettify/prettify.js"); +e107::js('theme', "js/google-code-prettify/prettify.js"); + +e107::css('inline','@media (min-width: 1000px){ body { padding-top: 75px; } } '); if(THEME_LAYOUT == 'docs') { @@ -25,6 +36,7 @@ if(THEME_LAYOUT == 'docs') } + //$no_core_css = TRUE; //define("STANDARDS_MODE",TRUE);