From f8733b7ea106d5a13ef32b1fcbb9c5018499a204 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 30 Aug 2019 18:41:51 -0700 Subject: [PATCH] Remove BOOTSTRAP and FONTAWESOME constants from bootstrap/theme.php --- e107_handlers/theme_handler.php | 14 +- e107_themes/bootstrap3/theme.php | 221 ++++++++++++++++--------------- e107_themes/bootstrap3/theme.xml | 4 +- 3 files changed, 123 insertions(+), 116 deletions(-) diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 0b0e91e51..311180247 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -157,9 +157,12 @@ class e_theme // If no scope set, we load library on both areas. if(empty($library['scope']) || $library['scope'] === 'all') { - if($library['name'] === 'bootstrap' && varset($library['version']) == 4) // quick fix. + if($library['name'] === 'bootstrap' && !empty($library['version'])) { - $library['name'] .= (string) $library['version']; + if(intval($library['version']) > 3) // quick fix. + { + $library['name'] .= (string) $library['version']; + } e107::getParser()->setBootstrap($library['version']); @@ -168,9 +171,12 @@ class e_theme define('BOOTSTRAP', (int) $library['version']); } } - elseif($library['name'] === 'fontawesome' && !empty($library['version'])) // quick fix. + elseif($library['name'] === 'fontawesome' && !empty($library['version'])) { - $library['name'] .= (string) $library['version']; + if(intval($library['version']) > 4) // quick fix. + { + $library['name'] .= (string) $library['version']; + } e107::getParser()->setFontAwesome($library['version']); diff --git a/e107_themes/bootstrap3/theme.php b/e107_themes/bootstrap3/theme.php index 0d9fbdf74..bd558d589 100644 --- a/e107_themes/bootstrap3/theme.php +++ b/e107_themes/bootstrap3/theme.php @@ -16,8 +16,7 @@ if(!defined('e107_INIT')) exit; } -define("BOOTSTRAP", 3); -define("FONTAWESOME", 4); + define('VIEWPORT', "width=device-width, initial-scale=1.0"); // CDN provider for Bootswatch. @@ -56,7 +55,13 @@ define('OTHERNEWS2_LIMIT', 3); // Limit to 3. define('COMMENTOFFSTRING', ''); define('PRE_EXTENDEDSTRING', '
'); - + + + + + + + class bootstrap3_theme { @@ -66,111 +71,108 @@ class bootstrap3_theme * @param string $id : id of the current render * @param array $info : current style and other menu data. */ - - function tablestyle($caption, $text, $id='', $info=array()) - { - // global $style; // no longer needed. - - $style = $info['setStyle']; - - echo "\n\n"; - - $type = $style; - if(empty($caption)) - { - $type = 'box'; - } - - if($style == 'navdoc' || $style == 'none') - { - echo $text; - return; - } - - /* - if($id == 'wm') // Example - If rendered from 'welcome message' - { - - } - - if($id == 'featurebox') // Example - If rendered from 'featurebox' - { - - } - */ - - - if($style == 'jumbotron') - { - echo '
-
'; - if(!empty($caption)) - { - echo '

'.$caption.'

'; - } - echo ' - '.$text.' -
-
'; - return; - } - - if($style == 'col-md-4' || $style == 'col-md-6' || $style == 'col-md-8') - { - echo '
'; - - if(!empty($caption)) - { - echo '

'.$caption.'

'; - } - - echo ' - '.$text.' -
'; - return; - - } - - if($style == 'menu') - { - echo '
-
'.$caption.'
-
- '.$text.' -
-
'; - return; - - } - - if($style == 'portfolio') - { - echo ' -
- '.$text.' -
'; - return; - } - - - - // default. - - if(!empty($caption)) - { - echo '

'.$caption.'

'; - } - - echo $text; - - - - return; - - - - } - + function tablestyle($caption, $text, $id='', $info=array()) + { + + + $style = $info['setStyle']; // global $style; // no longer needed. + + echo "\n\n"; + + /* + if($id == 'wm') // Example - If rendered from 'welcome message' + { + $style = ''; + } + + if($id == 'featurebox') // Example - If rendered from 'featurebox' + { + $style = ''; + } + */ + + switch($style) + { + case "navdoc": + case "none": + + echo $text; + + break; + + case "jumbotron": + + echo '
+
'; + + if(!empty($caption)) + { + echo '

'.$caption.'

'; + } + + echo ' + '.$text.' +
+
'; + + break; + + case "col-md-4": + case "col-md-6": + case "col-md-8": + + echo '
'; + + if(!empty($caption)) + { + echo '

'.$caption.'

'; + } + + echo ' + '.$text.' +
'; + + break; + + + case "menu": + + echo '
+
'.$caption.'
+
+ '.$text.' +
+
'; + + break; + + + case "portfolio": + + echo ' +
+ '.$text.' +
'; + + break; + + + + default: + + if(!empty($caption)) + { + echo '

'.$caption.'

'; + } + + echo $text; + // code to be executed if n is different from all labels; + } + + return null; + + } + } @@ -188,7 +190,7 @@ $NEWSCAT = "\n\n\n\n\n\n\n\n $NEWSCAT_ITEM = "\n\n\n\n\n\n\n\n -
+
•  @@ -196,4 +198,3 @@ $NEWSCAT_ITEM = "\n\n\n\n\n\n\n\n
"; -?> \ No newline at end of file diff --git a/e107_themes/bootstrap3/theme.xml b/e107_themes/bootstrap3/theme.xml index 691a052e9..f95b6dea8 100644 --- a/e107_themes/bootstrap3/theme.xml +++ b/e107_themes/bootstrap3/theme.xml @@ -19,8 +19,8 @@ preview_frontend.png - - + +