From 2083cf161edb567891f3246ba254f2ad9d547c96 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 28 Jan 2015 12:31:14 -0800 Subject: [PATCH] themePrefs can be set at installation time. see _blank/theme.xml for an example. --- e107_handlers/theme_handler.php | 35 ++++++++++++++++++++++++++-- e107_themes/_blank/_blank_config.php | 4 ++-- e107_themes/_blank/theme.xml | 6 ++++- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 695c97c9b..2cac08026 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -1587,6 +1587,13 @@ class themeHandler $core->set('sitetheme_custompages', $customPages); $core->set('sitetheme_version', $version); + + if(!empty($this->themeArray[$name]['preferences'])) + { + $core->set('sitetheme_pref', $this->themeArray[$name]['preferences']); + } + + // $core->set('sitetheme_releaseUrl', $this->themeArray[$name]['releaseUrl']); @@ -1966,10 +1973,18 @@ class themeHandler // loadLanFiles($path, 'admin'); // Look for LAN files on default paths // layout should always be an array. $xml->setOptArrayTags('layout,screenshots/image'); - $xml->setOptStringTags('menuPresets,customPages'); + $xml->setOptStringTags('menuPresets,customPages,custompages'); - $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true); + // $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true); + + $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', 'advanced', true); // must be 'advanced' + + if($path == "_blank" ) + { + // echo "
".print_a($vars,true)."".print_a($adv,true)."
"; + } + $vars['name'] = varset($vars['@attributes']['name']); $vars['version'] = varset($vars['@attributes']['version']); @@ -1988,6 +2003,17 @@ class themeHandler $vars['preview'] = varset($vars['screenshots']['image']); $vars['thumbnail'] = varset($vars['preview'][0]); + if(!empty($vars['themePrefs'])) + { + + foreach($vars['themePrefs']['pref'] as $k=>$val) + { + $name = $val['@attributes']['name']; + $vars['preferences'][$name] = $val['@value']; + } + } + + unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'],$vars['screenshots']); // Compile layout information into a more usable format. @@ -2069,6 +2095,11 @@ class themeHandler // $mes->addDebug("
"); } + if($path == "_blank" ) + { + // echo "
".print_a($vars,true)."".print_a($adv,true)."
"; + } + return $vars; } diff --git a/e107_themes/_blank/_blank_config.php b/e107_themes/_blank/_blank_config.php index 2b5c5ba00..1529c6d7d 100644 --- a/e107_themes/_blank/_blank_config.php +++ b/e107_themes/_blank/_blank_config.php @@ -23,11 +23,11 @@ class theme__blank implements e_theme_config $frm = e107::getForm(); $var[0]['caption'] = "Sample configuration field"; - $var[0]['html'] = $frm->text('_blank_example', e107::getThemePref('example', 'default')); + $var[0]['html'] = $frm->text('_blank_example', e107::pref('theme', 'example', 'default')); $var[0]['help'] = "Example help text for this input field"; $var[1]['caption'] = "Sample configuration field 2"; - $var[1]['html'] = $frm->text('_blank_example2', e107::getThemePref('example2', 'default')); + $var[1]['html'] = $frm->text('_blank_example2', e107::pref('theme', 'example2', 'default')); return $var; } diff --git a/e107_themes/_blank/theme.xml b/e107_themes/_blank/theme.xml index 8864cfbe0..3473fbe0a 100644 --- a/e107_themes/_blank/theme.xml +++ b/e107_themes/_blank/theme.xml @@ -1,7 +1,7 @@ - Bootstrap e107 admin theme + Blank Example theme Blank e107 Theme generic @@ -25,4 +25,8 @@ /forum + + Stored Theme value 1 + Stored Theme value 2 + \ No newline at end of file