function allowedRootThemes($themes)
{
$exceptions = array('pressbooks-root');
if (defined('PB_ROOT_THEME')) {
$exceptions[] = PB_ROOT_THEME;
}
if (isset($GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'])) {
if (is_array($GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'])) {
$exceptions = array_merge($exceptions, $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES']);
} else {
$exceptions[] = $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'];
}
}
$compare = search_theme_directories();
foreach ($compare as $key => $val) {
if (!in_array($key, $exceptions) && untrailingslashit($val['theme_root']) != PB_PLUGIN_DIR . 'themes-root') {
unset($themes[$key]);
}
}
return $themes;
}