';
$text .= "
";
$text .= '
';
if(is_array($xdata['data'] ))
{
$text .= '
';
$slides = array();
foreach($xdata['data'] as $r)
{
if(E107_DBG_PATH)
{
$mes->addDebug(print_a($r,true));
}
$theme = array(
'id' => $r['params']['id'],
'type' => 'theme',
'mode' => $r['params']['mode'],
'name' => stripslashes($r['name']),
'category' => $r['category'],
'preview' => varset($r['screenshots']['image']),
'date' => $r['date'],
'version' => $r['version'],
'thumbnail' => $r['thumbnail'],
//'url' => $r['url'],
'author' => $r['author'],
'website' => $r['authorUrl'],
'compatibility' => $r['compatibility'],
'description' => $r['description'],
'price' => $r['price'],
'livedemo' => $r['livedemo'],
);
$text .= $this->renderTheme(FALSE, $theme);
$c++;
if($c == 19)
{
$text .= '
';
$slides[] = 1;
$c = 1;
}
/*
[author] => e107 Inc
[summary] => Bootstrap e107 admin theme
[category] => generic
[keywords] => Array
(
[word] => Array
(
[0] => bootstrap
[1] => clean
)
)
[name] => bootstrap
[version] => 1.0
[date] => 2012-12-01
[compatibility] => 2.0
[releaseUrl] =>
[email] => e107inc@something.com
[website] => http://e107.org
[info] => Bootstrap e107 admin theme
[compliance] => Array
(
[@attributes] => Array
(
[xhtml] =>
[css] =>
)
)
[xhtmlcompliant] =>
[csscompliant] =>
[path] => bootstrap
*/
}
$text .= "
";
$text .= "
";
$text .= "
";
}
else
{
$mes->addInfo("No Themes found which match your search criteria");
}
$indicators = '
';
foreach($slides as $key=>$v)
{
$id = $key + 1;
$indicators .= '';
}
$indicators .= '
';
$text = str_replace("{CAROUSEL_INDICATORS}",$indicators,$text);
$text .= "";
$ns->tablerender(TPVLAN_26.SEP."Available for Download", $mes->render().$text);
}
function showThemes($mode = 'main')
{
global $pref;
$mes = e107::getMessage();
$ns = e107::getRender();
$tp = e107::getParser();
$frm = e107::getForm();
echo "
";
if($mode == "main" || !$mode) // Show Main Configuration
{
foreach ($this->themeArray as $key=>$theme)
{
if($key == $pref['sitetheme'])
{
$text = $this->renderTheme(1, $theme);
}
}
echo "
";
}
// Show Admin Configuration
if($mode == "admin")
{
foreach ($this->themeArray as $key=>$theme)
{
if($key == $pref['admintheme'])
{
$text = $this->renderTheme(2, $theme);
}
}
echo "
";
}
// Show Upload Form
if($mode == "upload")
{
$this->renderUploadForm();
}
// Show All Themes
if($mode == "choose")
{
$text = "";
foreach ($this->themeArray as $key=>$theme)
{
$text .= $this->renderTheme(FALSE, $theme);
// print_a($theme);
}
$text .= "
";
echo "
";
}
if($mode == "online")
{
$this->renderOnline();
}
echo "
\n";
}
function renderUploadForm()
{
$mes = e107::getMessage();
$ns = e107::getRender();
$sql = e107::getDb();
$frm = e107::getForm();
if(!is_writable(e_THEME))
{
$ns->tablerender(TPVLAN_16, TPVLAN_15);
$text = "";
}
else
{
require_once(e_HANDLER.'upload_handler.php');
$max_file_size = get_user_max_upload();
$text = "
";
}
$ns->tablerender(TPVLAN_26.SEP.TPVLAN_38, $mes->render().$text);
}
function renderThemeInfo($theme)
{
global $pref;
$author = ($theme['email'] ? "
".$theme['author']."" : $theme['author']);
$website = ($theme['website'] ? "
".$theme['website']."" : "");
$preview = "
".($theme['preview'] ? "" : "")."";
$description = vartrue($theme['description'],'');
$compat = (intval($theme['compatibility']) == 2) ? "
".number_format($theme['compatibility'], 1, '.','')." Recommended!": vartrue(number_format($theme['compatibility'], 1, '.',''),'1.0');
$price = ($theme['price'] > 0) ? "
".$theme['price']."" : "
".Free."";
$text = "
";
// $text .= "".$theme['name']." ".$theme['version']." |
";
$text .= $author ? "".TPVLAN_4.": | ".$author." |
" : "";
$text .= $website ? "".TPVLAN_5.": | ".$website." |
" : "";
$text .= $theme['date'] ? "".TPVLAN_6.": | ".$theme['date']." |
" : "";
$text .= $compat ? "".TPVLAN_57.": | ".$compat." |
" : "";
$text .= "Price: | ".$price." |
";
$text .= $description ? "Description: | ".$description." |
" : "";
// $text .= "".TPVLAN_49.": |
// XHTML ";
// $text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON;
// $text .= " CSS ";
// $text .= ($theme['csscompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON;
// $text .= " |
";
if(vartrue($theme['category']))
{
$text .= "Category | ".$theme['category']." |
";
}
// New in 0.8 WORK IN PROGRESS ----
if($theme['layouts'])
{
$itext .= "
".TPVLAN_50.": |
|
";
}
// $text .= "".TPVLAN_22.": | ";
// foreach ($theme['css'] as $val)
// {
// $text .= $val['name']." ";
// }
// $text .= " |
";
$text .= $itext."
";
if(count($theme['preview']))
{
$text .= "
";
foreach($theme['preview'] as $pic)
{
$picFull = (substr($pic,0,4) == 'http') ? $pic : e_THEME.$theme['path']."/".$pic;
$text .= "";
}
// $text .= " |
//
";
}
// $text .= "
";
if(E107_DEBUG_LEVEL > 0)
{
$text .= print_a($theme, true);
}
return $text;
}
function loadThemeConfig()
{
$mes = e107::getMessage();
$newConfile = e_THEME.$this->id."/theme_config.php";
$legacyConfile = e_THEME.$this->id."/".$this->id."_config.php"; // @Deprecated
if(is_readable($newConfile))
{
$confile = $newConfile;
}
elseif(is_readable($legacyConfile))// TODO Eventually remove it.
{
// NOTE: this is debug info.. do not translate.
e107::getMessage()->addDebug("Deprecated Theme Config File found! Rename
".$this->id."_config.php. to
theme_config.php to correct this issue. .");
$confile = $legacyConfile;
}
else
{
return;
}
if(($this->themeConfigObj === null) )
{
$mes->addDebug("Loading : ".$confile);
include ($confile);
$className = 'theme_'.$this->id;
if(class_exists($className))
{
$this->themeConfigObj = new $className();
}
else
{
$this->themeConfigObj = FALSE;
}
}
}
// TODO process custom theme configuration - .
function renderThemeConfig()
{
$mes = e107::getMessage();
$mes->addDebug("Rendering Theme Config");
$this->loadThemeConfig();
if($this->themeConfigObj)
{
$var = call_user_func(array(&$this->themeConfigObj, 'config'));
foreach ($var as $val)
{
$text = "
".$val['caption'].": | ".$val['html']." |
";
}
return $text;
}
}
function renderThemeHelp()
{
if($this->themeConfigObj)
{
return call_user_func(array(&$this->themeConfigObj, 'help'));
}
}
function setThemeConfig()
{
$this->loadThemeConfig();
if($this->themeConfigObj)
{
return call_user_func(array(&$this->themeConfigObj, 'process'));
}
}
/**
mode = 0 :: normal
mode = 1 :: selected site theme
mode = 2 :: selected admin theme
*/
function renderTheme($mode = FALSE, $theme)
{
$ns = e107::getRender();
$pref = e107::getPref();
$frm = e107::getForm();
$author = ($theme['email'] ? "
".$theme['author']."" : $theme['author']);
$website = ($theme['website'] ? "
".$theme['website']."" : "");
// $preview = "
".($theme['preview'] ? "" : "")."";
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "
" : E_32_TRUE;
// $info_icon = "
";
$info_icon = "
".E_32_CAT_ABOUT."";
// $preview_icon = "
".E_32_SEARCH."";
$admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "
\n" : E_32_TRUE;
$price = '';
if(substr($theme['thumbnail'],0,4) == 'http')
{
$thumbPath = $theme['thumbnail'];
$previewPath = $theme['preview'][0];
}
elseif(vartrue($theme['preview'][0]))
{
$thumbPath = e_THEME.$theme['path'] ."/".$theme['preview'][0];
$previewPath = e_THEME.$theme['path'] ."/".$theme['preview'][0];
}
else
{
$thumbPath = e_IMAGE_ABS."admin_images/nopreview.png";
$previewPath = e_BASE."index.php?themepreview.".$theme['id'];
}
$thumbnail = "
";
if($_GET['mode'] == 'online')
{
$d = http_build_query($theme,false,'&');
$url = e_SELF."?src=".base64_encode($d);
$id = $frm->name2id($theme['name']);
$LAN_DOWNLOAD = ($theme['price'] > 0) ? "Buy/Download" : "Download";
if($this->mp->hasAuthKey())
{
$action = 'download';
$caption = "Downloading ".$theme['name']." ".$theme['version'];
}
else
{
$action = 'login';
$caption = "Please login to your e107.org account to proceed..";
}
$downloadUrl = e_SELF.'?action='.$action.'&src='.base64_encode($d);//$url.'&action=download';
$infoUrl = $url.'&action=info';
//$main_icon = "
";
$main_icon = "
";
$info_icon = "
".trim(E_32_CAT_ABOUT)."";
if($theme['livedemo'])
{
$previewPath = $theme['livedemo'];
}
//XXX modal-Cache is currently enabled by default. Awaiting inclusion of data-cache feature.
// See here: https://github.com/twitter/bootstrap/pull/4224
$price = ($theme['price'] > 0) ? "
".$theme['price']."" : "
".Free."";
}
$preview_icon = "
".E_32_SEARCH."";
if(!in_array($theme['path'], $this->approvedAdminThemes))
{
$admin_icon = "";
}
if($theme['name'] == 'bootstrap')
{
// print_a($theme);
}
//
// $thumbPath = (substr($theme['thumbnail'],0,4) == 'http') ? $theme['thumbnail'] : e_THEME.$theme['path'] ."/".$theme['preview'][0];
// $thumbnail = "
";
// $thumbnail .= "";
// Choose a Theme to Install.
if(!$mode)
{
// styles NEED to be put into style.css
if($pref['sitetheme'] == $theme['path'])
{
$borderStyle = "admin-theme-cell-site";
}
elseif($pref['admintheme'] == $theme['path'])
{
$borderStyle = "admin-theme-cell-admin";
}
else
{
$borderStyle = "admin-theme-cell-default";
}
$borderStyle = 'well';
$text = "
".$thumbnail."
".$main_icon.$admin_icon.$info_icon.$preview_icon."
".$theme['name']." ".$theme['version']."
".$price."
";
return $text;
}
$this->id = $theme['path'];
// load customn theme configuration fields.
$this->loadThemeConfig();
$text = "
".$theme['name']."
".$this->renderThemeHelp()."
\n";
return $text;
}
function renderPresets($key)
{
require_once (e_HANDLER."menumanager_class.php");
$frm = e107::getForm();
$men = new e_menuManager();
$men->curLayout = $key;
$preset = $men->getMenuPreset();
$text .= "
".$frm->admin_button("setMenuPreset[".$key."]", "Activate Menus",'other');
$text .= '
";
return $text;
}
function renderPlugins($pluginOpts)
{
global $frm,$sql;
// if there is 1 entry, then it's not the same array.
$tmp = (varset($pluginOpts['plugin'][1])) ? $pluginOpts['plugin'] : $pluginOpts;
$text = "";
foreach ($tmp as $p)
{
$plug = trim($p['@attributes']['name']);
if(plugInstalled($plug))
{
$text .= $plug." ".ADMIN_TRUE_ICON;
}
else
{
// echo $plug;
if($sql->db_Select("plugin", "plugin_id", " plugin_path = '".$plug."' LIMIT 1 "))
{
$row = $sql->db_Fetch(MYSQL_ASSOC);
$name = "installplugin[".$row['plugin_id']."]";
$text .= $this->frm->admin_button($name, ADLAN_121." ".$plug."", 'delete');
}
else
{
$text .= (varset($p['@attributes']['url']) && ($p['@attributes']['url'] != 'core')) ? "
".$plug." " : "
".$plug."";
$text .= ADMIN_FALSE_ICON;
}
}
$text .= " ";
}
return $text;
}
function refreshPage($page = e_QUERY )
{
header("Location: ".e_SELF."?".$page);
exit;
}
function themePreview()
{
echo "\n";
exit;
}
function showPreview()
{
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_theme.php");
$text = "
".TPVLAN_1.".
";
global $ns;
$ns->tablerender(TPVLAN_2, $text);
}
/**
* Set Theme as Main Theme.
*
* @param string $name [optional] name (folder) of the theme to set.
* @return boolean TRUE on success, FALSE otherwise
*/
function setTheme($name = '', $contentCheck = true)
{
$core = e107::getConfig('core');
$sql = e107::getDb();
$mes = e107::getMessage();
$themeArray = $this->getThemes("id");
$name = ($name) ? $name : vartrue($themeArray[$this->id]);
$layout = $pref['sitetheme_layouts'] = is_array($this->themeArray[$name]['layouts']) ? $this->themeArray[$name]['layouts'] : array();
$deflayout = $this->findDefault($name);
$customPages = $this->themeArray[$name]['custompages'];
$version = $this->themeArray[$name]['version'];
$core->set('sitetheme', $name);
$core->set('themecss', 'style.css');
$core->set('sitetheme_layouts', $layout);
$core->set('sitetheme_deflayout', $deflayout);
$core->set('sitetheme_custompages', $customPages);
$core->set('sitetheme_version', $version);
// $core->set('sitetheme_releaseUrl', $this->themeArray[$name]['releaseUrl']);
if($contentCheck === true)
{
$sql->db_Delete("menus", "menu_layout !='' ");
}
e107::getCache()->clear_sys();
if($core->save())
{
//TODO LANs
$mes->addDebug("Default Layout: ".$deflayout);
$mes->addDebug("Custom Pages: ".print_a($customPages,true));
$med = e107::getMedia();
$med->import('_common_image', e_THEME.$name, "^.*?logo.*?(\.png|\.jpeg|\.jpg|\.JPG|\.GIF|\.PNG)$");
$med->import('_common_image', e_THEME.$name, '', 'min-size=20000');
if($contentCheck === true)
{
$this->installContentCheck($name);
}
$this->theme_adminlog('01', $name.', style.css');
return TRUE;
}
else
{
// $mes->add(TPVLAN_3."
'".$name."'", E_MESSAGE_ERROR);
return FALSE;
}
}
function installContentCheck($name)
{
$file = e_THEME.$name."/install/install.xml";
$frm = e107::getForm();
if(!is_readable($file))
{
return false;
}
$mes = e107::getMessage();
$xmlArray = e107::getXml()-> loadXMLfile($file, 'advanced');
$text = "
";
// $text .= print_a($xmlArray, true);
$mes->addWarning($text);
}
function installContent($name)
{
$mes = e107::getMessage();
$file = e_THEME.$name."/install/install.xml";
e107::getXml()->e107Import($file, 'replace', true, false); // Overwrite specific core pref and tables entries.
$mes->addSuccess(LAN_UPDATED);
}
function findDefault($theme)
{
if(varset($_POST['layout_default']))
{
return $_POST['layout_default'];
}
$l = $this->themeArray[$theme];
if(!$l)
{
$l = $this->getThemeInfo($theme);
}
if($l['layouts'])
{
foreach ($l['layouts'] as $key=>$val)
{
if(isset($val['@attributes']['default']) && ($val['@attributes']['default'] == "true"))
{
return $key;
}
}
}
else
{
return "";
}
}
function setAdminTheme()
{
global $pref,$e107cache;
$ns = e107::getRender();
$mes = e107::getMessage();
$themeArray = $this->getThemes("id");
$pref['admintheme'] = $themeArray[$this->id];
$pref['admincss'] = file_exists(e_THEME.$pref['admintheme'].'/admin_dark.css') ? 'admin_dark.css' : 'admin_light.css';
$e107cache->clear_sys();
if(save_prefs())
{
// Default Message
$mes->add(TPVLAN_40."
'".$themeArray[$this->id]."'", E_MESSAGE_SUCCESS);
$this->theme_adminlog('02', $pref['admintheme'].', '.$pref['admincss']);
}
// $ns->tablerender("Admin Message", "
".TPVLAN_40." '".$themeArray[$this -> id]."'.
");
// $this->showThemes('admin');
}
function setStyle()
{
global $pref,$e107cache;
$sql = e107::getDb();
$ns = e107::getRender();
$mes = e107::getMessage();
//TODO adminlog
e107::getConfig()->setPosted('themecss', $_POST['themecss'])->setPosted('image_preload', $_POST['image_preload'])->setPosted('sitetheme_deflayout',
$_POST['layout_default']);
$msg = $this->setThemeConfig();
if($msg)
{
$mes->add(TPVLAN_37, E_MESSAGE_SUCCESS);
if(is_array($msg))
$mes->add($msg[0], $msg[1]);
}
}
function setAdminStyle()
{
global $pref,$e107cache;
$ns = e107::getRender();
$mes = e107::getMessage();
/*$pref['admincss'] = $_POST['admincss'];
$pref['adminstyle'] = $_POST['adminstyle'];
$e107cache->clear_sys();
if(save_prefs())
{
$mes->add(TPVLAN_43, E_MESSAGE_SUCCESS);
$this->theme_adminlog('04',$pref['adminstyle'].', '.$pref['admincss']);
}
else
{
$mes->add(TPVLAN_43, E_MESSAGE_ERROR);
}*/
//TODO adminlog
e107::getConfig()->setPosted('admincss', $_POST['admincss'])->setPosted('adminstyle', $_POST['adminstyle']);
return (e107::getConfig()->dataHasChangedFor('admincss') || e107::getConfig()->dataHasChangedFor('adminstyle'));
}
function SetCustomPages($array)
{
if(!is_array($array))
{
return;
}
$newprefs = array();
foreach ($array as $key => $newpref)
{
$newpref = trim(str_replace("\r\n", "\n", $newpref));
$newprefs[$key] = array_filter(explode("\n", $newpref));
$newprefs[$key] = array_unique($newprefs[$key]);
}
if(e107::getPref('sitetheme_deflayout') == 'legacyCustom')
{
$newprefs['legacyCustom'] = array();
}
//setPosted couldn't be used here - sitetheme_custompages structure is not defined
e107::getConfig()->set('sitetheme_custompages', e107::getParser()->toDB($newprefs));
}
/**
* Set the Theme layouts, as found in theme.xml
*/
function setLayouts($name='')
{
$name = $this->id;
$layout = is_array($this->themeArray[$name]['layouts']) ? $this->themeArray[$name]['layouts'] : array();
e107::getConfig()->set('sitetheme_layouts', $layout);
}
// Log event to admin log
function theme_adminlog($msg_num = '00', $woffle = '')
{
if($this->noLog)
{
return;
}
global $pref,$admin_log;
// if (!varset($pref['admin_log_log']['admin_banlist'],0)) return;
$admin_log->log_event('THEME_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
}
function parse_theme_php($path)
{
$CUSTOMPAGES = "";
$tp = e107::getParser();
$fp = fopen(e_THEME.$path."/theme.php", "r");
$themeContents = fread($fp, filesize(e_THEME.$path."/theme.php"));
fclose($fp);
preg_match('/themename(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['name'] = varset($match[3], '');
preg_match('/themeversion(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['version'] = varset($match[3], '');
preg_match('/themeauthor(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['author'] = varset($match[3], '');
preg_match('/themeemail(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['email'] = varset($match[3], '');
preg_match('/themewebsite(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['website'] = varset($match[3], '');
preg_match('/themedate(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['date'] = varset($match[3], '');
preg_match('/themeinfo(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['info'] = varset($match[3], '');
preg_match('/xhtmlcompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match);
$xhtml = strtolower($match[2]);
$themeArray['xhtmlcompliant'] = ($xhtml == "true" ? "1.1" : false);
preg_match('/csscompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match);
$css = strtolower($match[2]);
$themeArray['csscompliant'] = ($css == "true" ? "2.1" : false);
/* preg_match('/CUSTOMPAGES(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
$themeArray['custompages'] = array_filter(explode(" ",$match[3]));*/
$themeContentsArray = explode("\n", $themeContents);
preg_match_all("#\\$"."CUSTOMHEADER\[(\"|')(.*?)('|\")\].*?#",$themeContents,$match);
$customHeaderArray = $match[2];
preg_match_all("#\\$"."CUSTOMFOOTER\[(\"|')(.*?)('|\")\].*?#",$themeContents,$match);
$customFooterArray = $match[2];
if(!$themeArray['name'])
{
unset($themeArray);
}
$lays['legacyDefault']['@attributes'] = array('title'=>'Default',
'plugins'=>'',
'default'=>'true');
// load custompages from theme.php only when theme.xml doesn't exist.
if(!file_exists(e_THEME.$path."theme.xml"))
{
foreach ($themeContentsArray as $line)
{
if(strstr($line, "CUSTOMPAGES"))
{
eval(str_replace("$", "\$", $line)); // detect arrays also.
}
}
if(is_array($CUSTOMPAGES))
{
foreach ($CUSTOMPAGES as $key=>$val)
{
$themeArray['custompages'][$key] = explode(" ", $val);
}
}
elseif($CUSTOMPAGES)
{
$themeArray['custompages']['legacyCustom'] = explode(" ", $CUSTOMPAGES);
$lays['legacyCustom']['@attributes'] = array('title'=>'Custom',
'plugins'=>'');
}
foreach($customHeaderArray as $tm)
{
$lays[$tm]['@attributes'] = array('title'=>str_replace("_"," ",$tm),
'plugins'=>'');
}
foreach($customFooterArray as $tm)
{
$lays[$tm]['@attributes'] = array('title'=>str_replace("_"," ",$tm),
'plugins'=>'');
}
}
$themeArray['path'] = $path;
$themeArray['layouts'] = $lays;
if(file_exists(e_THEME.$path."/preview.jpg"))
{
$themeArray['preview'] = array("preview.jpg");
$themeArray['thumbnail'] = "preview.jpg";
}
if(file_exists(e_THEME.$path."/preview.png"))
{
$themeArray['preview'] = array("preview.png");
$themeArray['thumbnail'] = "preview.png";
}
// echo "
".$themeArray['name']."
";
// print_a($lays);
return $themeArray;
}
function parse_theme_xml($path)
{
$tp = e107::getParser();
$xml = e107::getXml();
// 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');
$vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true);
$vars['name'] = varset($vars['@attributes']['name']);
$vars['version'] = varset($vars['@attributes']['version']);
$vars['date'] = varset($vars['@attributes']['date']);
$vars['compatibility'] = varset($vars['@attributes']['compatibility']);
$vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']);
$vars['email'] = varset($vars['author']['@attributes']['email']);
$vars['website'] = varset($vars['author']['@attributes']['url']);
$vars['author'] = varset($vars['author']['@attributes']['name']);
$vars['info'] = varset($vars['description']);
$vars['category'] = $this->getThemeCategory(varset($vars['category']));
$vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']);
$vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']);
$vars['path'] = $path;
$vars['@attributes']['default'] = (varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true') ? 1 : 0;
$vars['preview'] = varset($vars['screenshots']['image']);
$vars['thumbnail'] = varset($vars['preview'][0]);
unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'],$vars['screenshots']);
// Compile layout information into a more usable format.
$custom = array();
/*
foreach ($vars['layouts'] as $layout)
{
foreach ($layout as $key=>$val)
{
$name = $val['@attributes']['name'];
unset($val['@attributes']['name']);
$lays[$name] = $val;
if(isset($val['customPages']))
{
$cusArray = explode(" ", $val['customPages']);
$custom[$name] = array_filter($cusArray);
}
if(isset($val['custompages']))
{
$cusArray = explode(" ", $val['custompages']);
$custom[$name] = array_filter(explode(" ", $val['custompages']));
}
}
}
*/
foreach($vars['layouts']['layout'] as $k=>$val)
{
$name = $val['@attributes']['name'];
unset($val['@attributes']['name']);
$lays[$name] = $val;
if(isset($val['custompages']))
{
if(is_string($val['custompages']))
{
$custom[$name] = array_filter(explode(" ", $val['custompages']));
}
elseif(is_array($val['custompages']))
{
$custom[$name] = $val['custompages'];
}
}
}
$vars['layouts'] = $lays;
$vars['path'] = $path;
$vars['custompages'] = $custom;
if(vartrue($vars['stylesheets']['css']))
{
$vars['css'] = array();
foreach($vars['stylesheets']['css'] as $val)
{
$notadmin = vartrue($val['@attributes']['admin']) ? false : true;
$vars['css'][] = array("name" => $val['@attributes']['file'], "info"=> $val['@attributes']['name'], "nonadmin"=>$notadmin);
}
unset($vars['stylesheets']);
}
//
$mes = e107::getMessage(); // DEBUG
if($path == "leasure" )
{
// $mes->addDebug("
".$path."
");
// $mes->addDebug(print_a($vars,true));
// $mes->addDebug("
");
}
return $vars;
}
}
interface e_theme_config
{
/**
* Triggered on theme settings submit
* Catch and save theme configuration
*/
public function process();
/**
* Theme configuration user interface
* Print out config fields
*/
public function config();
/**
* Theme help tab
* Print out theme help content
*/
public function help();
}