1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

themePrefs can be set at installation time. see _blank/theme.xml for an example.

This commit is contained in:
Cameron 2015-01-28 12:31:14 -08:00
parent 7486ea37d0
commit 2083cf161e
3 changed files with 40 additions and 5 deletions

View File

@ -1587,6 +1587,13 @@ class themeHandler
$core->set('sitetheme_custompages', $customPages); $core->set('sitetheme_custompages', $customPages);
$core->set('sitetheme_version', $version); $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']); // $core->set('sitetheme_releaseUrl', $this->themeArray[$name]['releaseUrl']);
@ -1966,10 +1973,18 @@ class themeHandler
// loadLanFiles($path, 'admin'); // Look for LAN files on default paths // loadLanFiles($path, 'admin'); // Look for LAN files on default paths
// layout should always be an array. // layout should always be an array.
$xml->setOptArrayTags('layout,screenshots/image'); $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 "<table class='table'><tr><td>".print_a($vars,true)."</td><td>".print_a($adv,true)."</td></tr></table>";
}
$vars['name'] = varset($vars['@attributes']['name']); $vars['name'] = varset($vars['@attributes']['name']);
$vars['version'] = varset($vars['@attributes']['version']); $vars['version'] = varset($vars['@attributes']['version']);
@ -1988,6 +2003,17 @@ class themeHandler
$vars['preview'] = varset($vars['screenshots']['image']); $vars['preview'] = varset($vars['screenshots']['image']);
$vars['thumbnail'] = varset($vars['preview'][0]); $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']); unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'],$vars['screenshots']);
// Compile layout information into a more usable format. // Compile layout information into a more usable format.
@ -2069,6 +2095,11 @@ class themeHandler
// $mes->addDebug("<hr />"); // $mes->addDebug("<hr />");
} }
if($path == "_blank" )
{
// echo "<table class='table'><tr><td>".print_a($vars,true)."</td><td>".print_a($adv,true)."</td></tr></table>";
}
return $vars; return $vars;
} }

View File

@ -23,11 +23,11 @@ class theme__blank implements e_theme_config
$frm = e107::getForm(); $frm = e107::getForm();
$var[0]['caption'] = "Sample configuration field"; $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[0]['help'] = "Example help text for this input field";
$var[1]['caption'] = "Sample configuration field 2"; $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; return $var;
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e107Theme name="blank" version="1.0" date="2031-05-01" compatibility="2.0" livedemo='http://e107.org'> <e107Theme name="blank" version="1.0" date="2031-05-01" compatibility="2.0" livedemo='http://e107.org'>
<author name ="e107 Inc" email="nospam@e107.org" url="http://e107.org" /> <author name ="e107 Inc" email="nospam@e107.org" url="http://e107.org" />
<summary>Bootstrap e107 admin theme</summary> <summary>Blank Example theme</summary>
<description>Blank e107 Theme</description> <description>Blank e107 Theme</description>
<category>generic</category> <category>generic</category>
<compliance xhtml="1.1" css="2.1" /> <compliance xhtml="1.1" css="2.1" />
@ -25,4 +25,8 @@
<custompages>/forum</custompages> <custompages>/forum</custompages>
</layout> </layout>
</layouts> </layouts>
<themePrefs>
<pref name='example'>Stored Theme value 1</pref>
<pref name='example2'>Stored Theme value 2</pref>
</themePrefs>
</e107Theme> </e107Theme>